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.
-
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!"
-
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.
-
The user is visiting Thailand. He or she has 65 U.S. dollars. Convert the U.S. dollars to Thai baht currency and display.
- 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started