Question
IT JavaScript Temperature Converter Create a page with a title, a header, and 3 buttons: 1. Convert Celsius to Fahrenheit 2. Convert Fahrenheit to Celsius
IT JavaScript
Temperature Converter
Create a page with a title, a header, and 3 buttons:
1. Convert Celsius to Fahrenheit
2. Convert Fahrenheit to Celsius
3. Calculate BMI
Make sure that each button has a unique identifier.
Next, define the following functions in a script:
1. convertCF() prompts the user for a celsius temperature, and then converts it to fahrenheit and displays the result.
2. convertFC() prompts the user for a fahrenheit temperature, and then converts it to celsius and displays the result.
3. convertWeight() takes a weight (in pounds) and multiplies it by 0.45 to convert the weight to kilograms, and returns the result.
4. convertHeight() takes a height (in inches) and multiplies it by 0.025 to convert the height to meters, and returns the result.
5. square() takes a value and squares it (multiplies it by itself), and returns the result. Be sure to use Math.power.
6. calcBMI() performs the following steps: Prompt the user for their weight, in pounds, and store the result in a variable.
Prompt the user for their height, in inches, and store the result in a variable.
Convert the user's weight to kilograms using the convertWeight() function (#5, above).
Convert the user's height to meters using the convertHeight() function (#6, above).
Calculate BMI by dividing weight (in kilograms) by the height (in meters) squared.
Use the square() function you defined in #7, above.
Display the result, rounded to two decimal places
Finally, attach the convertCF, convertFC, and calcBMI functions to the appropriate button. Please remember to add notes to show what each step is doing.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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