Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help me code this. The assignment contains two parts. Basal metabolic rate. Study Observing Program Stack described here. As you program your project below, demonstrate

Help me code this.

The assignment contains two parts.

Basal metabolic rate. Study "Observing Program Stack" described here. As you program your project below, demonstrate to the lab instructor observing variables local to several function frames.

Create a project titled Lab5_BMR with a single file titled bmr.cpp The program should calculate the person's Basal Metabolic Rate - the number of calories per day a person's body needs to function. Then, on the basis of calculated BMR, your program should output how many doughnuts a person can consume. A medium-size doughnut contains 195 calories.

The BMR formula is as follows:

for women:

 655 + (4.3 x weight in pounds) + (4.7 x height in inches) - (4.7 x age in years) 

for men:

 66 + (6.3 x weight in pounds) + (12.9 x height in inches) - (6.8 x age in years) 

Depending on gender, BMR should be calculated by functions bmrWomen() and bmrMen() that both accept three parameters: "weight in pounds", "height in inches" and "age in years" and return the BMR. Note that the BMR has a fractional part.

The main function should prompt the user for her gender, weight, height and age; compute the BMR and the number of doughnuts that can be consumed per day; and then output both the BMR and the number doughnuts.

The number of doughnuts is: BMR divided by the number of calories in a doughnuts. Fractional number of doughnuts can be dropped. The number of calories per doughnut (195) should be put in a named constant.

On the basis of the user's gender, main() function should decide whether to invoke bmrWomen() or bmrMen(). The user should input her height in feet and inches. The main() function should compute the total number of inches (one foot has 12 inches) and pass it to the bmr functions.

Make sure to use the bmr function prototypes and put the function definitions below the main function definition.

Figures. Create a project titled Lab5_Figures. This project shall contain multiple files. Write a program that repeatedly asks the user to select either square, left or right triangle, then inputs the figure size and then prints the appropriate shape in stars. For square, the program should ask whether the user wants a filled or a hollow square. The program should quit if the user inputs an invalid option. See an example dialog below:

1. square 2. top left triangle 3. top right triangle select figure: 1 select size: 4 filled or hollow [f/h]: h **** * * * * **** 1. square 2. top left triangle 3. top right triangle ... 

You can reuse your code from the Looping lab. Place star-printing code in four separate functions: filledSquare, hollowSquare, leftTriangle and rightTriangle. Each function should accept a single integer parameter - the size of the figure and return no value (be a void-function). Create three separate files figures.cpp, figures.h, and figuresInput.cpp. Place the triangle and square function definitions in figures.cpp and their prototypes in figures.h. Make sure that the header file is protected against multiple inclusion. Place the main function in figuresInput.cpp

2-

Figures. Create a project titled Lab5_Figures. This project shall contain multiple files. Write a program that repeatedly asks the user to select either square, left or right triangle, then inputs the figure size and then prints the appropriate shape in stars. For square, the program should ask whether the user wants a filled or a hollow square. The program should quit if the user inputs an invalid option. See an example dialog below:

1. square 2. top left triangle 3. top right triangle select figure: 1 select size: 4 filled or hollow [f/h]: h **** * * * * **** 1. square 2. top left triangle 3. top right triangle ... 

You can reuse your code from the Looping lab. Place star-printing code in four separate functions: filledSquare, hollowSquare, leftTriangle and rightTriangle. Each function should accept a single integer parameter - the size of the figure and return no value (be a void-function). Create three separate files figures.cpp, figures.h, and figuresInput.cpp. Place the triangle and square function definitions in figures.cpp and their prototypes in figures.h. Make sure that the header file is protected against multiple inclusion. Place the main function in figuresInput.cpp

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

What was the role of the team leader? How was he or she selected?

Answered: 1 week ago

Question

What were the issues and solutions proposed by each team?

Answered: 1 week ago