<homework>
  spacerspacer

Assignments

Assignment 2 (Three Questions):

 

For our last assignment we'll create a JS application using the prompt() command and functions of your devising to retrieve and validate the following data:

  1. The user's name
  2. The user's favorite color
  3. How many shrubberies the user has brought you

These three questions must all be answered (data entry required) and the number of shrubberies must require integer input. Once the data is returned, you must make sentences from the data to output to the window in our eval form. Here is a sample of the input/output:

Prompt: Who would cross the Bridge of Death must answer me these questions three, ere the other side he see. What is your name?

User: Arthur

Prompt: What is your favorite color?

User: Blue - no yellow!

Prompt: How many shrubberies have you brought me?

User: 3

Output: Your name is Arthur, your favorite color is blue no yellow and you have brought me 3 shrubberies!

These questions are based on the British Comedy Monty Python and the Holy Grail. Here are some of the famous Quotes from the film.

The first and second questions must require data to be entered. The third question must require an integer to be input. The output of the number of shrubberies must include the proper plural or singular. Missing any of these items is 20 points off each!

(Any questions regarding the air speed velocity of unladen swallows has been disallowed due to a lack of numerical plurality.)

HINT: To require integer input, you can adapt a version of getDecimal() and change it to getInteger(). Requiring data to be input was covered in class on Tuesday the 12 and is part of exercise #3 from that day. Review the Elluminate from Tuesday the 12th if you are unsure of how to proceed.

Bring a printed copy of your completed assignment, and be prepared to run your application in class on the due date.

EXTRA CREDIT: Make your application display the users's favorite color as part of the output, ie: if the favorite color is blue, make the output make the text of the word actually blue for a possible 20 extra points!

This assignment is worth 100 points, and is due Thursday, April 14th.


Assignment 1 (Temperature Conversion):

 

For this assignment you will be building a program using the JavaScript prompt command to convert a number input as a temperature in Fahrenheit to Celsius.

Your application must:

  • Request the user enter a number of degrees in Fahrenheit, to convert to Celcius
  • Use the getDecimal() function to require proper input
  • Convert the number input from Fahrenheit to Celcius
  • Pop up an alert() that will output a line of text indicating the new value
  • Format the output (Celsius) to two decimal places

The sentence returned via the alert() should be correct and indicate both the input and the output:

You entered 32.00 degrees Fahrenheit which is 0.00 degrees Celsius

Here is the calculation you will use to do the conversion:

C = (F-32) * 5 / 9

Be sure to use the Program Design page for help in designing your program!

HINT: Use the example code linked on the class website as a model for much of the work to be done here.  It will make your work a lot easier!

Bring a printed copy of your completed assignment, and be prepared to run your application in class on the due date.

EXTRA CREDIT: Make your application correctly convert both Fahrenheit to Celcius and Celcius to Fahrenheit for a possible additional 20 points!

This assignment is worth 100 points, and is due Tuesday, April 12th.

 

 

 

Print this Page Back To Top

2000- 2011 newMANIC INC, All rights reserved