Create a program that calculates a persons Body Mass Index (BMI). You will need
ID: 3558312 • Letter: C
Question
Create a program that calculates a persons Body Mass Index (BMI).
You will need the persons height in inches and their weight in pounds.
The formula to calculate the Body Mass Index is:
BMI = ( W * 703 ) / ( H * H )
Where: BMI = Body Mass Index
W = weight in pounds
H = height in inches
In addition to correctly calculating the numeric value of the BMI, your program should also display the descriptive word that corresponds to the following range of BMI values:
Range of BMI Values
Description
Less than 18.5
Underweight
18.5 or greater, but less than 25
Normal
25 or greater, but less than 30
Overweight
30 or greater
Obese
Your program should do the following:
1. Prompt the user for their weight in pounds.
2. Prompt the user for their height in inches.
3. Echo the weight and height values back to the User.
3. Calculate and display the BMI value.
4. Display the descriptive word that corresponds to their BMI value.
To receive full credit for this programming assignment, you must:
**
Include your name as the programmer in a comment near the top of the file that contains the program
Range of BMI Values
Description
Less than 18.5
Underweight
18.5 or greater, but less than 25
Normal
25 or greater, but less than 30
Overweight
30 or greater
Obese
Explanation / Answer
Program Code:
#include "stdafx.h"
#include<iostream>
using namespace std;
int main()
{
double height, weight;
double bmi;
cout<<"Enter height in inches:";
cin>>height;
cout<<"Weight in pounds: ";
cin>>weight;
cout<<"Height="<<height<<"Weight="<<weight<<endl;
bmi=( weight * 703 ) / ( height * height );
cout<<"BMI is: "<<bmi<<endl;
if(bmi<18.5)
cout<<"Underweight"<<endl;
else if(bmi>=18.5 && bmi<25)
cout<<"Normal"<<endl;
else if(bmi>=25 && bmi<30)
cout<<"verweight"<<endl;
else
cout<<"Obese";
system("pause");
return 0;
}
Sample Output:
Enter height in inches:63
Weight in pounds: 132
Height=63Weight=132
BMI is: 23.3802
Normal
Press any key to continue . . .
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.