Question: IT JavaScript BMI Calculator For this assignment, you will write a BMI (Body-Mass Index) calculator. BMI is calculated by dividing weight (in kilograms) by height

IT JavaScript

BMI Calculator

For this assignment, you will write a BMI (Body-Mass Index) calculator. BMI is calculated by

dividing weight (in kilograms) by height (in meters) squared.

(Incidentally, a lot of people think BMI charts are bogus. Read more at

https://www.businessinsider.com/bmi-is-bogus-best-way-to-tell-if-youre-a-healthy-weight-2016-9)

Create the Form

Begin by creating the page shown below, and save your file to your directory.

Your page should also have an empty

, which you will use for displaying results.

Define the Functions

Next, create a JavaScript file called assn6.js that defines the following functions:

1. checkInputs () accepts a height and a weight as parameters. If either height or weight are negative or NaN, returns false. Otherwise, it returns true.

2. convertWeight() takes a weight in pounds, multiplies it by 0.45 to convert it to kilograms, and returns the result.

3. convertHeight() takes a height in inches, multiplies it by 0.025 to convert it to meters, and returns the result.

4. calcBMI() takes a height and a weight as parameters. It divides the weight (in KG) by the height (in meters) squared, and returns the result. It should use the convertWeight() and convertHeight() functions.

5. getRange() takes a BMI and returns the corresponding range, based on the following conversions:

BMI Range

19- 24 Healthy

25-29 Overweight

30-39 Obesity

40+ Extreme Obesity

Code the button function

Now we bring it all together! Begin by linking to your JS file from your HTML file. Then, write a function called go() that executes when the Calculate button is clicked. The go function should:

Get the inputs from the text boxes.

if the inputs are valid, display the BMI and the Range. BMI should be rounded to one decimal place.

If the inputs are not valid, display an error message.

Fully test your application. Be sure to fully utilize the functions youve written. You should not be repeating any of the logic in your function file. Sample output is shown above.

**Please add notes showing what each step is doing. Thank you.

30-39 Obesity 40+ Extreme Obesity Code the button function Now we bring it all together! Begin by linking to your JS file from your HTML file. Then, write a function called go() that executes when the Calculate button is clicked. The go function should: * Get the inputs from the text boxes. If the inputs are valid, display the BMI and the Range. BMI should be rounded to one decimal place If the inputs are not valid, display an error message. Fully test your application. Be sure to fully utilize the functions you've written. You should not be repeating any of the logic in your function file. Sample output is shown below BMI Calculator Calculate your BMI (Body-Mass Index) Body Mass Index (BMI) is based upon your weight and your height and is a number that healthcare providers use to estimate the amount of body fat that you have. Height (in inches): 72 Your BMI is 26.4 You fall in the Overweight range Weight (in pounds): 190 Calculate BMI Calculator Calculate your BMI (Body-Mass Index) Body Mass Index (BMI) is based upon your weight and your height and is a number that healthcare providers use to estimate the amount of body fat that you have. Height (in inches):-60 Height and weight must be greater than zero. Weight (in pounds): 200 Calculate Submission Make sure you follow all code specifications, and that each function has at least one comment. Submit the URL in Canvas, and turn in a hard copy of your code at the beginning of class

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!