// This program calculates the the users's BMI and Target Heart Rate
#include <iostream>
usingnamespace std;
int main ()
{
int weight, // user's current weight in pounds
age, // user's current age in years
height, // user's current height in inches
target; // target heart rate
char answer; // user's Y/N answer
double bmi; // body mass index
cout<< "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" <<endl;
cout<< "||| |||" <<endl;
cout<< "||| Welcome to Happy Valley Fitness Center! |||" <<endl;
cout<< "||| Where We Care About Your Health |||" <<endl;
cout<< "||| |||" <<endl;
cout<< "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" <<endl;
cout<< "Let's check your current fitness level!" << endl;
cout<< "We will determine your target heart rate and body mass index." <<endl;
cout<< "All we need is your age, height, and weight." << endl;
cout<< endl;
//user enters age
cout<< "How old are you?" <<endl;
cin>> age;
cout<< endl;
//user enters height
cout<< "What is your height in inches? (Remember 1 foot = 12 inches)" <<endl;
cin>> height;
cout<< endl;
//user enters weight
cout<< "What is your weight (in pounds)? " <<endl;
cin>> weight;
cout<< endl;
//calculate bmi and target heart rate.
bmi = (weight * 703.0) / (height * height);
target = (220 - age) * 0.70;
//display bmi and target heart rate.
cout<< "The results are in!" <<endl;
cout<< "Target heart rate: " <<endl;
cout<< target <<endl;
cout<< "Body Mass Index: " <<endl;
cout<< bmi <<endl;
//teach user about bmi
cout<< "Learn more about your Body Mass Index (BMI). This number is a ratio of height to weight. It is an indication of your current body fat level." <<endl;
cout<< "The Center for Disease Control guidelines for BMI are:" <<endl;
cout<< "Below 18.5 Underweight" <<endl;
cout<< "18.5 - 24.9 Normal" <<endl;
cout<< "25.0 - 29.9 Overweight" <<endl;
cout<< "30.0 and Above Obese" <<endl;
//display user's weight status.
if (bmi < 18.5)
{ cout<< "Your BMI category is UNDERWEIGHT.";
}
elseif (bmi >= 18.5 && bmi < 25)
{ cout<< "Your BMI category is NORMAL.";
}
elseif (bmi >= 25 && bmi < 30)
{ cout<< "Your BMI category is OVERWEIGHT.";
}
else
{ cout<< "Your BMI category is OBESE.";
}//end if statement