BMI Calculator
Statement
Goal
You are tasked by the United States Department of Health and Human Services with creating a Body Mass Index (BMI) calculator. You will be given a weight in pounds (lb) and a height in feet (ft) and inches (in) and must output the users BMI. The output must be rounded to the nearest one tenth.Additionally, the user should be informed of their weight status given the following categories associated with BMI ranges:
Below 18.5: "Underweight"
18.5 - 24.9: "Normal"
25.0 - 29.9: "Overweight"
30.0 and Above: "Obese"
The weight status is defined after rounding. A BMI calculation of 29.99 would be considered "Obese".
There are 12 inches in a foot.
The formula for BMI is: 703 * weight (lb) / [height (in)]^2
Example:
weight = 150lbs
height = 5ft 5in
703 * [150 ÷ (5 * 12 + 5)^2] = 25.0
Their weight status is "Overweight"
Input
Line 1: An integer representing the weight of the user in pounds.
Line 2: Two space separated integers representing the height of the user in feet and inches.
Line 2: Two space separated integers representing the height of the user in feet and inches.
Output
Line 1: The BMI of the user rounded to the nearest tenth.
Line 2: The string representing the Weight Status of the user as defined above. "Underweight", "Normal", "Overweight", or "Obese"
Line 2: The string representing the Weight Status of the user as defined above. "Underweight", "Normal", "Overweight", or "Obese"
Constraints
0 < weight < 1000
1 <= height ft <= 9
0 <= height in < 12
1 <= height ft <= 9
0 <= height in < 12
Example
Input
150 5 5
Output
25.0 Overweight
Game modes
Fastest
Test cases
Overweight Test
Input
150
5 5
Output
25.0
Overweight
Overweight Validator
Input
155
5 6
Output
25.0
Overweight
Normal Test
Input
165
5 11
Output
23.0
Normal
Normal Validator
Input
140
5 7
Output
21.9
Normal
Extreme Test
Input
974
6 0
Output
132.1
Obese
Extreme Validator
Input
646
5 7
Output
101.2
Obese
Underweight Test
Input
140
6 2
Output
18.0
Underweight
Underweight Validator
Input
130
5 11
Output
18.1
Underweight
Obese Test
Input
180
5 5
Output
30.0
Obese
Obese Validator
Input
197
5 8
Output
30.0
Obese
Solution language
Solution
Stub generator input