Question: Please write JavaScript code for the four exercises listed below. When finished all the code should fit together in an HTML document. Be sure to

Please write JavaScript code for the four exercises listed below. When finished all the code should fit together in an HTML document. Be sure to document your work with comments for code management.

This assignment is to be completed in your lab section.

  1. Prompt the visitor for his or her age. Assign the users response to the variable 'age'. Ensure the age is a number before testing it. Ask the visitor if they have registered to vote. If the age is equal to or over 21 and they have registered to vote, respond with the message "Don't forget to vote this November!"

  2. Ask the user for a Fahrenheit temperature, and then convert it to Celsius. Use parseFloat(). Formula for conversion: C = 5/9(F 32). Display both the Fahrenheit and Celsius temperatures.

  3. The user is visiting Thailand. He or she has 65 U.S. dollars. Convert the U.S. dollars to Thai baht currency and display.

  4. Calculate the area of a circle (A = (/4) D2). Ask the user for the diameter. Declare Pi as a constant value of 3.14. Display the output as: "The area of a circle with a diameter of [x] is [y]."

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!