1. Write a C++ program to calculate Basal Metabolic Rate and total calorie needs. Use the Harris Benedict equation to calculate calorie needs.
2. The program must use at least three functions or procedures.
3. (See the additional handouts for BMR and Total Calories)
4. The input to the program will be the weight in pounds, the height in inches, the age, and the character 'm' for male and 'f' for female. Read the input data in a procedure using call by reference.
5. The output of the program will be the BMR and Total Calories Needs for each data set. The program must use an end-of-file loop to get credit. Also, echo print the input data for each data set. Write the information in formatted columns with heads.
INPUT:
(FIle included)
OUTPUT:
it looks exactly like the input
Step 1: calculating the BMR
BMR calculation for men : BMR = 66.5 + ( 13.75 x weight in kg ) + ( 5.003 x height in cm ) - ( 6.755 x age in years )
BMR calculation for men : BMR = 66 + ( 6.23 x weight in pounds ) + < 12.7 x height in inches ) - ( 6.76 x age in years )
BMR calculation for women : BMR = 665.1 + ( 9.563 x weight in kg ) + ( 1.850 x height in cm ) - ( 4.676 x age in years )
BMR calculation for women : BMR = 655 + ( 4.35 x weight in pounds ) + ( 4.7 x height in inches ) - (4.7 x age in years )
Step 2: applying the Harris-Benedict Principle
Little to no exercise ------------------------------------------------------------------- Daily calories needed = BMR x 1.2
Light exercise (1-3 days per week)------------------------------------------------- Daily calories needed = BMR x 1.375
Moderate exercise ( 3-5 days per week )------------------------------------------- Daily calories needed = BMR x 1.55
Heavy exercise ( 6-7 days per week ) ----------------------------------------------- Daily calories needed = BMR x 1.725
Very heavy exercise ( twice per day, extra heavy workouts ) -------------------- Daily calories needed = BMR x 1.9
Applications for weight loss
Using the formulae above, a 24-year old, 80 kg male who is 180 cm would have a BMR of 1900. If he exercised moderately, he would multiply his BMR
by his activity level (1900 x 1.55) to determine daily calorie requirements, which would be 2945 kcal per day to keep his weight at 80 kg. This may seem like a high calorie intake, but his activity level requires it. This individual would exercise normally but not lose weight. The same individual without the exercise routine would only be able to consume 2273 kcal per day without gaining weight. The US Department of Health and Human Services Daily Value Guidelines provides figures that support the above example.
Using the Harris-Benedict Equation, individuals can take a mathematical approach to weight loss. There are 3500 calories in 1lb (0..45) of body fat. Using the Harris-Benedict Principle, if someone has a daily allowance of 2500 calories, but he reduces his intake to 2000, then they calculations show a 1 pound loss every 7 days.
this is what I have so far, please help me! :3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
int main ()
{
ifstream inFile;
inFile.open("input.txt");
int calories;
int weightInPounds, heightInInches, ageInYears, activityLevel, totalCalories;
char gender;
int bmr;
cout << "Weight Height Age Gender Activity Level BMR Total Calories" << endl;
while (inFile);
{
cout << "------ ------ --- ------ -------------- --- --------------" << endl << endl;
//Height
//Weight
//gender
//activity level
inFile >> activityLevel;
char gender;
if (gender == 'm')
{
float bmrsumM = 66 + (6.23 * weightInPounds) + (12.7 * heightInInches) - (6.76 * ageInYears);
float activitysum;
//selects which activity level the user is
switch (activityLevel)
{
case 1: activitysum = bmrsumM * 1.2;
break;
case 2: activitysum = bmrsumM * 1.375;
break;
case 3: activitysum = bmrsumM * 1.55;
break;
case 4: activitysum = bmrsumM * 1.725;
break;
case 5: activitysum = bmrsumM * 1.9;
break;
}
//end selection
}
else
{
float bmrsumF = 655 + (4.35 * weightInPounds) + (4.7 * heightInInches) - (4.7 * ageInYears);
float activitysum;
switch(activityLevel)
{
case 1: activitysum = bmrsumF * 1.2;
break;
case 2: activitysum = bmrsumF * 1.375;
break;
case 3: activitysum = bmrsumF * 1.55;
break;
case 4: activitysum = bmrsumF * 1.725;
break;
case 5: activitysum = bmrsumF * 1.9;
break;
}
}
}
cout << "press enter to exit" << endl;
cin.ignore();
cin.get();
return 0;
}
|