Figure 535 shows that MifflinSt Jeor formulas for calculatin

Figure 5-35 shows that Mifflin-St Jeor formulas for calculating a person\'s basal metabolic rate (BMR), which is the minimum number of calories needed to keep his or her body functioning while resting for 24 hours. A personal trainer at a local health club wants a program that displays a client\'s BMR. a. Create an IPO chart for the problem, and then desk check the algorithm twice. For the first desk-check, display the BMR for a 25 year old male whose weight and height are 175 pounds and 6 feet, respectively. For the second desk check, display the BMR for a 31 year old female whose weight and height are 130 pounds and 5.5 feet, respectively. b. List the input, processing, and output items, as well as the algorithm, in a chart similar to the one shown earlier in figure 5-27. Then code the algorithm into a program. c. Desk check the program using the same data used to desk-check the algorithm. d. Display the BMR in fixed point notation with no decimal places. Test the program using the same data used to desk-check the program.

heres the chart

BMR formulas

Males = (10 x weight in kg)+ (6.25 x height in cm) - (5 x age in years) + 5

Females = (10 x weight in kg) + (6.25 x height in cm) - (5 x age in years) - 161

note: one kilogram equals 2.2 pounds one inch equals 2.54 centimeters

The programming language is c++

Solution

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
char gender;
int age,bmr;
float weight,height;
float weight_kg,height_cm;
clrscr();
cout<<\"enter the person\'s gender(m for male ,f for female\"<<endl;
cin>>gender;
cout<<\"enter the person\'s weight\"<<endl;
cin>>weight;
cout<<\"enter the person\'s height\"<<endl;
cin>>height;
cout<<\"enter the age of the person\"<<endl;
cin>>age;

height_cm=height*30.48;
weight_kg=weight/2.2;

switch(gender)
{
case \'m\':
      bmr=(10*weight_kg)+(6.25*height_cm)-(5*age)+5;
      cout<<\"BMR of the given person is \"<<endl;
      cout<<bmr;
      break;

case \'f\':
      bmr=(10*weight_kg)+(6.25*height_cm)-(5*age)-161;
      cout<<\"BMR of the given person is \"<<endl;
      cout<<bmr;
      break;
default:
   cout<<\"enter the valid options..(m or f)\"<<endl;
}


}

sample output
enter the person\'s gender(m for male, f for female)
m
enter the person\'s weight
175
enter the person\'s height
6
enter the age of the person
25
BMR of the given person is
1818


enter the person\'s gender(m for male, f for female)
f
enter the person\'s weight
130
enter the person\'s height
5.5
enter the age of the person
31
BMR of the given person is
1322

Figure 5-35 shows that Mifflin-St Jeor formulas for calculating a person\'s basal metabolic rate (BMR), which is the minimum number of calories needed to keep h
Figure 5-35 shows that Mifflin-St Jeor formulas for calculating a person\'s basal metabolic rate (BMR), which is the minimum number of calories needed to keep h

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site