Question
Write a Computer Program that computes the Body Mass Index (BMI) of a person knowing the persons height in inches, weight in pounds. The user
- Write a Computer Program that computes the Body Mass Index (BMI) of a person knowing the persons height in inches, weight in pounds. The user inputs the height and weight. Then the program checks if the height and weight are non-negative, or 0, if so, then the program immediately gives an error message and ask the user to enter these again.
The BMI is computed as below:
BMI = BMI_CONSTANT * weight / height2
Where BMI_CONSTANT is defined as a constant whose value is 703
Once the BMI is computed, display the BMI value rounded up to nearest integer. Also, check the value of BMI and display the following message depending on the value.
If BMI is less than 20, display underweight, have a milk shake
If BMI is more than or equal to 20, but less than or equal to 25, display, Normal, have a glass of milk.
If BMI is higher than 25, but less than or equal to 30, then display Overweight, have a glass of ice tea.
If BMI is higher than 30, display Obese, see your doctor.
The rounding to nearby integer can be done, by using the round(BMI) , need to include cmath.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started