Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ //**************************************************************** // BMI Program // This program calculates the body mass index (BMI) given a weight // in pounds and a height in inches

c++
//****************************************************************
// BMI Program
// This program calculates the body mass index (BMI) given a weight
// in pounds and a height in inches and prints a health message
// based on the BMI. Input in English measures.
//*****************************************************************
#include
using namespace std;
int main()
{
const int BMI_CONSTANT = 703; // Constant in non-metric formula
float weight; // Weight in weight
float height; // Height in height
float bodyMassIndex; // Appropriate BMI
bool dataIsOK; // True if data non-negative
// Prompt for and input weight and height
cout
cin >> weight;
cout
cin >> height;
// Test data
if (weight
dataIsOK = false;
else
dataIsOK = true;
if (dataIsOK)
{
// Calculate body mass index
bodyMassIndex = weight * BMI_CONSTANT / (height * height);
// Print message indicating status
cout
cout
if (bodyMassIndex
cout
else if (bodyMassIndex
cout
else if (bodyMassIndex
cout
else
cout
}
else
cout
return 0;
}
image text in transcribed
image text in transcribed
image text in transcribed
Exercise 1: Comple and run program BMI (BMI. eppl, using your own statistics Exercise 2: The cutoff values for the various weight categorles are glven as descrete values as shown below. BMI 20 20-25 26-30 Over 30 Interpretation Underweight Normal Overweight Obese Examine the code of the program and determine the categories that the following BMI values fall into. BMI Value 19.99 20 25.9 30 30.9 31 Interpretation

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions