Question: End result: Starter Code: (ToDo's are where I need to fill in the code) // TODO: Declare and initialize a constant that represents the //

End result:

Starter Code: (ToDo's are where I need to fill in the code)
// TODO: Declare and initialize a constant that represents the
// conversion rate from inches to centimeters.
// TODO: Declare and initialize a constant that represents the
// conversion rate from pounds to kilograms.
cout
cout
cout
cout
string sex;
cin >> sex;
cout
bool is_male_flag = false;
is_male_flag = (sex == "m");
// TODO: Prompt for the age of the subject in years
// TODO: Declare an int variable to store the subject's age in years.
// TODO: Read the value of the subject's age from the keyboard and store
// the value in the previously defined variable.
// TODO: Print to the terminal the value saved for the subject's age
// TODO: Prompt to determine what unit system to use; US or metric
// TODO: Declare a variable to store the response from the previous prompt
// TODO: Read the value from the keyboard and store the value in the previously defined variable.
// TODO: Print to the terminal the value saved for the unit system
// TODO: Declare and initialize a boolean variable named is_metric_flag
// TODO: assign the variable is_metric_flag true if the subject entered
// "m" and false otherwise (meaning they entered "u")
// TODO: Declare and initialize a float variable for the height
// Remember to initialize all floats to NAN.
// TODO: Prompt the subject to enter the value for height.
// Use the is_metric_flag to figure out which system is being used
// and adjust the prompts accordingly.
// Remember to immediately convert inches to centimeters
// You will need to use an if-else statement.
// TODO: Prompt the subject to enter the value for weight.
// Use the is_metric_flag to figure out which system is being used
// and adjust the prompts accordingly.
// Remember to immediately convert pounds to kilograms
// You will need to use an if-else statement.
// TODO: Declare and initialize a float variable for the 's'
// variable in the BMR formula
// TODO: using the is_male_flag, determine the value of the 's'
// variable in the BMR formula
// Calculate the BMR of the subject using the Mifflin St Jeor
// formula and the values entered by the subject.
// TODO: uncomment the next two lines once you have the other
// parts of the program set up.
//float bmr = (10.0F * mass_kg) + (6.25F * height_cm) -
// (5.0F * float(age_years)) + magic_s;
// TODO: Declare a string variable to hold the subject's sex
// TODO: Using an if-else block and the is_male_flag, determine
// what string should be used for the subject and assign it to the
// variable previously declared.
// if male, then "male" else "female"
// TODO: Declare a string variable to hold the subject's pronoun
// TODO: Using an if-else block and the is_male_flag, determine
// what string should be used for the subject and assign it to the
// variable previously declared.
// if male, then "He" else "She"
// TODO: Summarize the data that was entered in a nicely formatted string
// TODO: Report the subject's BMR using the correct pronoun.
Basal Metabolic Rate or BMR Ever wonder how much energy you burn just laying there breathing? You can estimate how much energy your body uses doing nothing by calculating your Basel Metabolic Rate. In this exercise, we'll write a program which uses the the Mifflin St Jeor equation to estimate a subject's BMR. Our test subject shall have their sex, age, height, and weight recorded and subsequently used to calculate their BMR. Their BMR is given in kilocalories. In everyday conversation, we refer to kilocalories as calories. Requirements The BMR calculation must use the Mifflin St Jeor equation. The Mifflin St Jeor equation is where m is mass measured in kilograms, h is height measured in centimeters, and a is age measured in years. The variables is +5 for males and - 161 for females. Bear in mind that this calculation is an estimate. There are many factors that must be considered to accurately estimate a person's BMR. Write a program that prompts the computer user to enter the details of the subject being considered. Provide the option to input the data values in metric units (kilograms, centimeters, and years) or in U.S. customary units (pounds, inches, and years). In order to convert units, standardize the logic of your program to use metric units. Estimate the metric equivalent of the U.S. customary units by using the following ratios for conversion. 1 pound is approximately 0.4535 kilograms (or 1 kilogram is approximately 2.205 pounds) 1 inch is approximately 2.54 centimeters (or 1 centimeter is approximately 0.3937 inches) 1 metric year is approximately 1 U.S. year (thank heavens!) You shall use cout to print messages to the terminal and you shall use cin to read in values from the keyboard. The program reads in five values from the terminal, stores them in at least five different variables and then prints out a message summarizing the data and the resulting BMR calculation. A mixture of different types must be used in this program. Many of the numeric values are decimal numbers so float or double types must be used. In other cases, the value may be stored as an int. Be mindful of how you perform your calculations. Input from the keyboard that requires letters shall be stored as strings. Do not use char. The starting code defines a series of TODO comments which you can use to formulate your plan and develop your program. Write your program progressively. Compile your program often and check that you're making progress. Make sure your program behaves the way you expect. The output of your program must match the output given in the section Example Output below. To compile your program, you use the make command. A Makefile is provided for this exercise. This program estimates the basal metabolic rate using the Mifflin St Jeor Equation. Please enter the subject's sex. Please enter 'm' for male or 'f' for female: f You entered 'f' Please enter the subject's age in years (no decimal point please): 23 You entered 23 years old. Would you like to enter the subject's height and weight in metric units (kg & cm) or U.S. customary units (in, lbs)? Enter 'm' for metric and 'u' for U.S.: u You entered 'u'. Please enter height in inches, decimal points are OK: 63 Please enter weight in pounds, decimal points are OK: 120 Given the details of the female subject of 23 years of age, with a height of 160.02 cm and a weight of 54.42 kg... She has a BMR of 1268.32 kcal per day. $ ./bmr This program estimates the basal metabolic rate using the Mifflin St Jeor Equation. Please enter the subject's sex. Please enter 'm' for male or 'f' for female: m You entered 'm' Please enter the subject's age in years (no decimal point please): 38 You entered 30 years old. Would you like to enter the subject's height and weight in metric units (kg & cm) or U.S. customary units (in, lbs)? Enter 'm' for metric and 'u' for U.S.: u You entered 'u'. Please enter height in inches, decimal points are OK: 70 Please enter weight in pounds, decimal points are OK: 174 Given the details of the male subject of 30 years of age, with a height of 177.8 cm and a weight of 78.909 kg... He has a BMR of 1755.34 kcal per day
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
