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

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!