Create a Visual C++ application that lets the user enter his or her weight (in pounds) and height (in inches). The application should calculate the user's body mass index (BMI). The BMI is often use to determine whether a person is overweight or underweight for his or her height. Program will display 1. Weight, 2. Height, 3. BMI, and a message.

The person's BMI is calculated with the following formula:

bmi =(weight*703) / height2

Variable bmi is declared as double. Variables weight and height are declared as double.

Your program will have the following functions:

1.Function getData will receive data from the user. It will prompt the user to enter weight and height.

getData (weight, height);//function that receives data

The prompt messages are:

Enter weight (in pounds) : _
Enter height (in inches) :_

2.Function computeBMI will compute and return the Body Mass Index.

bmi = computeBMI (weight, height); //function computes and returns BMI

3.Function display will display the results and the message.

display (weight, height, bmi);//function that displays results

The functions are kept inside a do..while loop to repeat the process using the response (y/n).

do
{
Function call
Function call
Function call
cout << "Do you want to process another set of data? (Y/N) ";
cin >> again;
again = toupper(again);
while ((again != 'Y') && (again != 'N')) //ERROR TRAP
{
cout << "ERROR: Enter Y/N: ";
cin >> again;
again = toupper(again);
}
}
while (response == 'y'|| response == 'Y');

Sample display:

(Before the display, use system("cls") to clear the output screen.

Sample #1:

Enter weight (in pounds) : 170
Enter height (in inches) : 68

Display:

Weight (in pounds): 170
Height (in inches): 68
------------- Blank Line --------------
The person’s BMI is 25.85

A BMI of 25.0 or more is overweight, while the healthy range is 18.5 to 24.9. BMI applies to most adults 18-65 years.

Programmer: Your name

cout << "Do you want to process another set of data? (Y/N) "

Sample #2:

Enter weight (in pounds) : 150
Enter height (in inches) : 70

Weight (in pounds): 150
Height (in inches): 70
------------- Blank Line --------------
The person’s BMI is 21.52

A BMI of 25.0 or more is overweight, while the healthy range is 18.5 to 24.9. BMI applies to most adults 18-65 years.

Programmer: Your name

cout << "Do you want to process another set of data? (Y/N) "

Display format: The weight and height will be displayed with no digits after decimal point. The BMI will be displayed with 2 digits after the decimal point.

(Use fixed, showpoint, and setprecision for formatting)

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.