(This assignment was suggested by Joel H in 2012.)
The body mass index (BMI) is commonly used by health and nutrition professionals to estimate human body fat in populations. It is computed by taking the individual's weight (mass) in kilograms and dividing it by the square of their height in meters.
Start with the BMI Calculator you
wrote previously (BMICalc.java). Then use some if
statements to show the category for a given BMI.
BMI | category |
---|---|
less than 18.5 | underweight |
18.5 to 24.9 | normal weight |
25.0 to 29.9 | overweight |
30.0 or more | obese |
Note: Although BMI is a very good estimate of human body fat, the formula doesn't work well for athletes with a lot of muscle, or people who are extremely short or very tall. If you are concerned about your BMI, check with your doctor.
Your height in m: 1.75 Your weight in kg: 73 Your BMI is 23.83673 BMI Category: normal weight
It doesn't matter whether you input the values in metric (kilos and meters) or Imperial measurements (feet/inches and pounds).
Your height in inches: 69 Your weight in pounds: 220 Your BMI is 32.5 BMI Category: obese
For +10 bonus points, use more if
statements
to show the ALL the BMI categories.
BMI | category |
---|---|
less than 15.0 | very severely underweight |
15.0 to 16.0 | severely underweight |
16.1 to 18.4 | underweight |
18.5 to 24.9 | normal weight |
25.0 to 29.9 | overweight |
30.0 to 34.9 | moderately obese |
35.0 to 39.9 | severely obese |
40.0 and up | very severely (or "morbidly") obese |
Your height in inches: 70 Your weight in pounds: 90 Your BMI is 12.9 BMI Category: very severely underweight
©2013 Graham Mitchell
This assignment is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.