Homework 3 Csc211.
Due Wednesday feb 4 (11:59pm)
Problem 1 (50 Points)
You can use either the Scanner class or pop-up windows to get the input.
A quantity known as the body mass index (BMI) is used to calculate the risk of weight-related health problems. BMI is computed by the formula.
BMI = W / (H / 100.0)
2
A BMI of about 20 - 25 is considered normal. Write a program to compute a persons BMI. Name your class BMI.
Requirements:
-
In the formula
W
stands for weight in kilograms, the user will enter their weight in pounds. So you have to convert pounds to kilograms. -
In the formula
H
stands for height in centimeters, the user will enter their height in feet then inches. So you will have to convert this into centimeters. Use two input statements. One for the foot part the other for the inch part. For example if my height is 5'11 then use one input statement to get the 5 the second to get the 11. I would convert the foot part to inches then get the total height in inches then convert to centimeters. - Use the pow method from the Math class to find the denominator in the formula.
If your math is rusty there are plenty of resources online that will help you with the conversions. Also there are probably a few BMI calculators online for you to check your answers. Don't worry if your results are not exactly the same as the calculators online.
Work incrementally, that is start by getting the weight from the user, convert it to kilograms then out put the converted value. Run the program a few times just entering in the weight pick a few values for the weight in pounds and verify that your are converting it to kilograms properly. Next get the height make sure you are converting the height to inches. Then go on and convert it to centimeters, check that result. Then apply the formula. Finish the program.