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

  1. 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

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!