Answer:
See explaination and attachment for the program code and output
Explanation:
#include <iostream>
using namespace std;
int main()
{
char gender; //details for gender and checking
char ans;
do
{
cout<<"Gender (M or F): ";
cin>>gender;
switch(gender)
{
case 'M':
//cout<<"Male."<<endl;
break;
case 'F':
//cout<<"Female."<<endl;
break;
default:
cout<<"Wrong Gender. Please enter again (M or F): ";
cin>>gender;
}
int Weight,Height,Age; //declaration of variables
double bmr;
cout<<"Weight: ";
cin>>Weight;
cout<<"Height (in inches): ";
cin>>Height;
cout<<"Age: ";
cin>>Age;
//bmr calculations for male and female
if (gender = 'M')
{
bmr = 66 + (6.3 * Weight) + (12.9 * Height) - (6.8 * Age);
cout<<"He needs "<<bmr<<" to maintain his weight."<<endl;
cout<<"He needs to eat "<<(bmr/230)<< " candy bars in one day."<<endl;
}
else if (gender = 'F')
{
bmr = 655 + (4.3 * Weight) + (4.7 * Height) - (4.7 *Age);
cout<<"She needs "<<bmr<<" to maintain her weight"<<endl;
cout<<"She needs to eat "<<(bmr/230)<< " candy bars in one day."<<endl;
}
cout<< "Do you want to do another one>continue (Y/N): ";
cin >> ans;
}while(ans=='y'||ans=='Y');
cout<<"\n Thanks for using my BMR calculator. Good Bye!.";
return 0;
}
Kindly check attachment for output.