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
|
#include "Genie.h"
void Genie::affirmLife()
{
cout << '\n' << name << " says hello\n\n";
}
string Genie::giveFortune ()
{
string fortune[20] = {
"As I see it, yes",
"It is certain",
"It is decidedly so",
"Most likely",
"Outlook good",
"Signs point to yes",
"Without a doubt",
"Yes",
"Yes - definitely",
"You may rely on it",
"Reply hazy, try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again",
"Don't count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful"};
cout << "Ask me your question and I will tell you my Answer.\n";
string quest = reader.readString();
int outcome = rand () % 20 + 1;
return fortune[outcome];
}
void Genie::calorie ()
{
int weight,height,age;
char gender;
float bmr, activity;
cout << "Please tell me how much you weigh. In pounds.(60-400)\n";
weight = reader.readInt(60,400);
cout << "Please tell me how tall you are. In inches.(38-84)\n";
height = reader.readInt(38,84);
cout << "Please tell me how old you are. In years.\n";
age = reader.readInt(1,100);
cout << "Please tell me your gender. (M/F)\n";
gender = reader.readChar("mfMF");
if (gender == 'M'|| gender =='m')
bmr = maleBmr (weight,height,age);
else
bmr = femaleBmr (weight,height,age);
activity = printBmrmenu ();
cout << "You Should be consuming " << (activity * bmr) << "Every Day" << endl;
}
float Genie::maleBmr (int w, int h, int a)
{
float bmr = (655 + ( 4.35 * w) + ( 4.7 * h) - ( 4.7 * a));
return bmr;
}
float Genie::femaleBmr(int w, int h, int a)
{
float bmr = (66 + ( 6.23 * w) + ( 12.7 * h) - ( 6.8 * a));
return bmr;
}
float Genie::printBmrmenu ()
{
float activity;
int mainchoice;
cout << "How active is your daily lifestyle?\n"
<< "1. If you are sedentary (little or no exercise)\n"
<< "2. If you are lightly active (light exercise/sports 1-3 days/week)\n"
<< "3. If you are moderatetely active (moderate exercise/sports 3-5 days/week)\n"
<< "4. If you are very active (hard exercise/sports 6-7 days a week)\n"\
<< "5. If you are extra active (very hard exercise/sports & physical job or 2x training)\n"
<< endl;
mainchoice = reader.readInt(1,5);
switch (mainchoice)
{
case 1:
activity = 1.2;
break;
case 2:
activity = 1.375;
break;
case 3:
activity = 1.55;
break;
case 4:
activity = 1.725;
break;
case 5:
activity = 1.9;
break;
}
return activity;
}
|