Question

Write a basic C++ program that will calculate a subject’s basal metabolic rate and estimate how...

Write a basic C++ program that will calculate a subject’s basal metabolic rate and estimate how many days it will take to lose a specific number of pounds. The program will perform the following tasks:

  1. Declare variables and Named constants.
  2. Display “Welcome to <your name>’s Weight Loss Calculator”
  3. Prompt the user to enter the subject’s current weight.
  4. Prompt the user to enter the subject’s height in feet plus inches.
  5. Prompt the user to enter the subject’s age.
  6. Prompt the user to enter the subject’s sex. (hint use type char to store M or F)
  7. Prompt the user to enter the subject’s Activity Level (1.2-1.9) Sedentary-Extremely Active
  8. Prompt for the daily calorie reduction the subject is willing to sustain at current activity level: (hint use a variable named calReduc)
  9. Prompt for the subject’s target weight
  10. Prompt the user to enter the subject’s first name.
  11. Calculate the subject’s height in inches (height= feet *12+ inches)
  12. If the subject is Female – calculate basal metabolic rate: bmr= 655.0955 + (4.35 * weight ) + (4.7 * height) - (4.6756 * age).
  13. Use Named Constants for the Factors 655.0955, 4.35, 4.7, and 4.6756.
  14. Else for males – calculate bmr= 66.473 + (6.237621 * weight) + (12.70838 * height) - (6.755 * age).
  15. Use Named Constants for the Factors 66.473, 6.237621, 12.70838 , and 6.755
  16. Calculate the adjusted bmradj=bmr*actLevel.
  17. Calculate the required daily caloric intake: dailyCals=bmradj-calReduc;
  18. Calculate weight to lose: wtToLose=weight-targetWt.
  19. Calculate days to target weight; daysToTarget = 3500*wtToLose/calReduc
  20. Clear the console screen: (hint use system(“cls”);)
  21. Display to the monitor the report heading
  22. Display the subject’s bmr, adjusted bmr, caloric reduction, required caloric intake, weight to lose, days to reach target as shown in the report layout below.
  23. Thank the user for using the calculator.
  24. Calculate and display the number of days needed to reach a (Body Mass Index) BMI of 23.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

bmiCal.cpp

//

// main.cpp

// bmiCalculator

//

// for Chegg on 18/02/20.

#include <iostream>

using namespace std;

const double oneM = 66.473;

const double twoM = 6.237621;

const double threeM = 12.70838;

const double fourM = 6.755;

const double oneF = 655.0955;

const double twoF = 4.35;

const double threeF = 4.7;

const double fourF = 4.6756;

int main(int argc, const char * argv[]) {

  

system("clear"); // Replace clear with cls for your system, mine was MAC - Xcode

  

float weight;

int inch, feet, height;

int age;

char sex;

char activityLevel;

int calReduc;

float targetWt, wtToLose, daysToTarget;

  

double bmr;

double bmradj;

double dailyCals;

  

string name;

  

cout << "Enter Your Weight\n";

cin >> weight;

cout << "Enter Your Height : Feet-\n";

cin >> feet;

cout << "Enter Your Height : Inch-\n";

cin >> inch;

cout << "Enter Your Age\n";

cin >> age;

cout << "Enter Your Sex, M - Male | F - Female\n";

cin >> sex;

cout << "Enter Your Activity Level, S - Sedentary | E - Extremely Active\n";

cin >> activityLevel;

cout << "Enter Your Calorie Reduction\n";

cin >> calReduc;

cout << "Enter Your Targeted Weight\n";

cin >> targetWt;

cout << "Enter Your Name\n";

cin >> name;

  

height = (feet * 12) + inch;

  

// BMR

if(sex=='M'){

bmr= oneM + (twoM * weight) + (threeM * height) - (fourM * age);

cout << bmr;

}

else if(sex=='F'){

bmr= oneF + (twoF * weight ) + (threeF * height) - (fourF * age);

cout << bmr;

}

  

// Adjusted BMR

if(activityLevel=='S'){

bmradj = bmr * 1.2;

cout << "\n\nAdjusted BMR is:\n";

cout << bmradj;

}

else if(activityLevel=='E'){

bmradj = bmr * 1.9;

cout << "\n\nAdjusted BMR is:\n";

cout << bmradj;

}

  

dailyCals = bmradj - calReduc;

cout << "\n\nRequired Calorie Intake:\n";

cout << dailyCals;

  

wtToLose = weight - targetWt;

cout << "\n\nWeight To Lose:\n";

cout << wtToLose;

  

daysToTarget = 3500 * wtToLose / calReduc;

cout << "\n\nDays To Target Weight:\n";

cout << daysToTarget;

cout << "\n";

return 0;

}

Screenshot of the output

Please let me know in the comments if any additions are needed.

Please rate.

Add a comment
Know the answer?
Add Answer to:
Write a basic C++ program that will calculate a subject’s basal metabolic rate and estimate how...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • IN PYTHON ONLY!!! Program 2: Design (Pseudocode) and implement (Source Code) a program that asks the...

    IN PYTHON ONLY!!! Program 2: Design (Pseudocode) and implement (Source Code) a program that asks the user for their height (in inches), weight (in pounds), age and gender. Use loops to validate user input and to continue running for a new user until a sentinel value is entered. Ask them to select their approximate level of exercise each week from the options below, then determine and print their allowed daily caloric intake using their BMR: Female BMR = 655+(4.35 *...

  • Y F G Prompt and Store. 5. Prompt the user with "Enter your weight in pounds:...

    Y F G Prompt and Store. 5. Prompt the user with "Enter your weight in pounds: "message and store in the weight variable. 6. Initialize an int variable named heightIn Inches to feet OſHeight times 12 plus Inches OfHeight. 7. Initialize a double variable named BMI to weight * 703.0 heightIrinches El VB 8. Initialize a double variable named ratio to height In Inches? 703.0 9. Initialize a double variable named lower Normal to 18.5 times ratio. 10. Initialize a...

  • Write a single C++ program that performs the following conversion (The modulus divide will help you...

    Write a single C++ program that performs the following conversion (The modulus divide will help you get the remainder as shown in class) 39 / 12 = 3 and 39 % 12 = 3, so 3 feet 3 inch(es) Height conversion 1 meter = 39 inches 12 inches = 1 foot Ask/Prompt the user to enter in the height in meters, convert and output the result in feet and inches Example 1 meters as input should produce 3 feet (foot)...

  • Answer in C using basic C and loops. ASSIGNMENT: Write a program that will display how...

    Answer in C using basic C and loops. ASSIGNMENT: Write a program that will display how many times a ball will bounce until its height is less than 1 inch. A ball has a property called the coefficient of restitution, a number between 0.0 and 1.0, that indicates how 'bouncy' the ball is. A coefficient of restitution of .5 means that the ball will bounce-up 50% of its initial height after each bounce Write a program to ask the user...

  • Basic Nutrition (NUT 00200) Homework Assignment #3 Client Name: Brandon Anderson Age: 29 years old Height:6'0"...

    Basic Nutrition (NUT 00200) Homework Assignment #3 Client Name: Brandon Anderson Age: 29 years old Height:6'0" Weight: 200 lbs Current Percent Body Fat: 26 Desired Percent Body Fat: 16 Physical Activity: None 1. Calculate Brandon's BMI. What is his Weight Category? 2. According to the Body Fat Chart for Men, what is 3. Determine his Goal Body Weight and the amount of weight 4. Determine his Resting Energy and Total Energy 5. Use the Body Weight Planner web application to...

  • Write them in python IDLE ***** 5. Average Rainfall Write a program that uses nested loops...

    Write them in python IDLE ***** 5. Average Rainfall Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations,...

  • C++ programming For this assignment, write a program that will act as a geometry calculator. The...

    C++ programming For this assignment, write a program that will act as a geometry calculator. The program will be menu-driven and should continue to execute as long as the user wants to continue. Basic Program Logic The program should start by displaying a menu similar to the following: Geometry Calculator 1. Calculate the area of a circle 2. Calculate the area of a triangle 3. Quit Enter your choice(1-3): and get the user's choice as an integer. After the choice...

  • Write a program in java. You are tasked with writing an application that will keep track...

    Write a program in java. You are tasked with writing an application that will keep track of Insurance Policies. Create a Policy class called InsurancePolicies.java that will model an insurance policy for a single person. Use the following guidelines to create the Policy class: • An insurance policy has the following attributes: o Policy Number o Provider Name o Policyholder’s First Name o Policyholder’s Last Name o Policyholder’s Age o Policyholder’s Smoking Status (will be “smoker” or “non-smoker”) o Policyholder’s...

  • need help!! c++ HW_6b - Calculate the average Use a do-while loop Write a program that...

    need help!! c++ HW_6b - Calculate the average Use a do-while loop Write a program that first prompts the user for an upper limit: Enter the number of entries: 5 € (user enters 5) After the user enters a number, the program should prompt the user to enter that many numbers. For example, if the user enters 5, then the program will ask the user to enter 5 values. Use a do-while loop to add the numbers. o With each...

  • PAYTHON PROGRAM WITHOUT ANY FUNCTION AND METHOD A program that will allow a grocery store to...

    PAYTHON PROGRAM WITHOUT ANY FUNCTION AND METHOD A program that will allow a grocery store to keep track of the total number of bottles collected for a seven-day period. The program should allow the user to enter the number of bottles returned for each day of the seven-day period. The program will accumulate the total number of bottles returned for the 7-day period. Then calculate the amount paid out (the total bottles returned times .10 cents). The output (display) of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT