Answer to Question #330875 in C++ for Christine

Question #330875

In late 1990’s, the Department of Education started to get concern about the health of every public school students.



According to their research, a child performs well if he/she is getting the right nutrition their body needs. In order



solve this, they started a feeding program and monitors each student health records. Adapt the method of monitoring



the students’ Body Mass Index (BMi) helps the department to solve this concern . The body mass index (BMi) is



used to estimate the risk of weight-related problems based on a student’s height and mass. it was designed by the



mathematician Adolphe Quetelet in the 1800s and is sometimes referred to as the Quetelet index. The BMI is



computed as





In this formula, mass is in kilograms and height is in meters. The health risk associated with a BMI value are



• Underweight < 18.5



• Normal weight ≥ 18.5 and < 25



• Overweight ≥ 25 and < 30



• Obese ≥ 30

1
Expert's answer
2022-04-19T08:50:46-0400
#include <iostream>
using namespace std;


double calculateBMI(double height, double weight) {
    return weight / (height * height);
}


int main() {
    double height, weight;


    cout << "Enter your height (m): ";
    cin >> height;
    cout << "Enter your weight (kg): ";
    cin >> weight;


    double bmi = calculateBMI(height, weight);


    cout << "Your BMI is " << bmi << endl;
    if (bmi < 18.5) {
        cout << "You are underweight" << endl;
    }
    else if (bmi < 25) {
        cout << "You have a normal weight" << endl;
    }
    else if (bmi < 30) {
        cout << "You are overweight" << endl;
    }
    else {
        cout << "You are obese" << 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
New on Blog
APPROVED BY CLIENTS