• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

EXERCISES

1:Create a while loop that displays numbers as: 10 9 8 7 6 5 4 3 2 1.
2:Ask the user what the current hour is. If the hour is between 6 and 9 a.m., tell him, “Breakfast is served.” If the hour is between 11 a.m. and 1 p.m., tell him, “Time for lunch.” If the hour is between 5 and 8 p.m., tell him, “It's dinner time.” For any other hours, tell him, “Sorry, you'll have to wait, or go get a snack.”
3:Create a conversion table using the following formula:
C = (F – 32) / 1.8;

Start with a Fahrenheit temperature of 20 degrees and end with a temperature of 120 degrees; use an increment value of 5. The table will have two columns, one for Fahrenheit temperature values and one for those same temperatures converted to Celsius.

4:Ask the user for the name of the company that developed the JavaScript language. Alert him when he is wrong, and then keep asking him until he gets the correct answer. When he gets it right, confirm it.
5:Use a switch statement to evaluate the menu item selected to produce output similar to what you see below.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint