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 89 90 91 92 93 94 95 96 97 98 99 100 101
|
#include <iostream>
#include <cmath>
using namespace std;
void input(double&weight, double&timeActivity, double&intensity, double&calsFavorite);
double getBmr(double bmr);
double getCals_activity(double cals_activity);
double getE_digest(double e_digest);
double getServings(double servings);
void output(double&weight, double&timeActivity, double&intensity, double&calsFavorite);
int main() {
double weight, timeActivity, intensity, calsFavorite;
double bmr, cals_activity, e_digest, servings;
// bmr = 0;
// cals_activity = 0;
// e_digest = 0;
// servings = 0;
input(weight, timeActivity, intensity, calsFavorite);
getBmr(bmr);
getCals_activity(cals_activity);
getE_digest(e_digest);
getServings(servings);
output(weight, timeActivity, intensity, calsFavorite);
cout << "Given the information you entered,\n";
cout << "You should be consuming the following caloric amounts:\n";
cout << bmr << " calories to maintain your body's Basal Metabolic Rate.\n";
cout << cals_activity << " calories to perform the physical activty for " << timeActivity << " minutes.\n";
cout << "The energy required for digestion = " << e_digest << " calories.\n";
cout << "The total amount of servings you should consume of your\n";
cout << "favorite food per day to maintain your current weight\n";
cout << "at the specified activity level is: " << servings << " servings.\n";
}
void input(double&weight, double&timeActivity, double&intensity, double&calsFavorite) {
cout << "Enter your weight in pounds.\n";
cin >> weight;
cout << "Enter the amount of time spent doing physical activity.\n";
cin >> timeActivity;
cout << "Estimate the intensity level of the physical activity.\n";
cin >> intensity;
cout << "Enter the amount of calories in one serving of your favorite food.\n";
cin >> calsFavorite;
}
double getBmr(double bmr) {
double weight;
bmr = 70 * pow((weight / 2.2) ,0.756);
return bmr;
}
double getCals_activity(double cals_activity) {
double intensity, weight, minutes;
cals_activity = 0.0385 * intensity * weight * minutes;
return cals_activity;
}
double getE_digest(double e_digest) {
double bmr, cals_activity;
e_digest = (bmr + cals_activity) * 0.1;
return e_digest;
}
double getServings(double servings) {
double bmr, cals_activity, calsFavorite;
servings = (bmr + cals_activity) / calsFavorite;
return servings;
}
void output(double&weight, double&timeActivity, double&intensity, double&calsFavorite) {
// double bmr, cals_activity, e_digest, servings;
// double weight, timeActivity, intensity, calsFavorite;
cout << "Information entered: \n";
cout << "Weight: " << weight << " lbs.\n";
cout << "Time spent doing activity: " << timeActivity << " minutes.\n";
cout << "Intensity of activity = " << intensity << ".\n";
cout << "Calories in one serving\n";
cout << "of your favorite food = " << calsFavorite << " calories.\n\n";
}
|