Answer to Question #69177 in C++ for Jcullen

Question #69177
4) Suppose BMI = WeightInKilos/(HeightInMetres X HeightInMetres). Design and code a BMI calculator in C++ that will read a person’s weight and height and displays the person’s BMI. Before the person’s BMI is displayed, the following information should be shown:
BMI VALUES
Underweight: less than 18.5
Normal: between 18.5 and 24.9
Overweight: between 25 and 29.9
Obesse: 30 and above
2n
Cbest
P(x) = anxn +….+ a0
1
Expert's answer
2017-07-06T12:04:07-0400
#include <iostream>

using namespace std;



int main() {
double weightInKilos, heightInMetres, BMI;
cout << "This is a BMI calculator!\n";
cout << "BMI VALUES\n";
cout << "Underweight: less than 18.5\n";
cout << "Normal: between 18.5 and 24.9\n";
cout << "Overweight: between 25 and 29.9\n";
cout << "Obesse: 30 and above\n\n";
cout << "Prompt a person weight in kilos: ";
cin >> weightInKilos;
cout << "Prompt a person height in metres: ";
cin >> heightInMetres;
if (!heightInMetres) {
cout << "Invalid value of height!\n";
return 0;
}
BMI = weightInKilos / (heightInMetres * heightInMetres);
cout << "You BMI is " << BMI << endl;

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS