1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
harina [27]
3 years ago
5

Project 8:The Harris-Benedict equation estimates the number of calories your body needs to maintain your weight if you do no exe

rcise. This is called your basal metabolic rate, or BMR.The calories needed for a woman to maintain her weight is:BMR = 655 + (4.3 Ã weight in pounds) + (4.7 Ã height in inches) â (4.7Ã age in years)The calories needed for a man to maintain his weight is:BMR = 66 + (6.3 Ã weight in pounds) + (12.9 Ã height in inches) â (6.8 Ã age in years)A typical chocolate bar will contain around 230 calories. Write a program that allows the user to input his or her weight in pounds, height in inches, and age in years. The program should then output the number of chocolate bars that should be consumed to maintain oneâs weight for both a woman and a man of the input weight, height, and age.
Repeat the calorie-counting program described in Programming Project 8 from Chapter 2. This time ask the user to input the string "M" if the user is a man and "W" if the user is a woman. Use only the male formula to calculate calories if "M" is entered and use only the female formula to calculate calories if "W" is entered. Output the number of chocolate bars to consume as before.

Engineering
1 answer:
lilavasa [31]3 years ago
4 0

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.

You might be interested in
How does Hydro Technology and Hydro Energy Help with Global Water Issues?
GrogVix [38]
It would have environmental and societal impacts
5 0
3 years ago
Air enters a cmpressor at 20 deg C and 80 kPa and exits at 800 kPa and 200 deg C. The power input is 400 kW. Find the heat trans
aksik [14]

Answer:

The heat is transferred is at the rate of 752.33 kW

Solution:

As per the question:

Temperature at inlet, T_{i} = 20^{\circ}C = 273 + 20 = 293 K

Temperature at the outlet, T_{o} = 200{\circ}C = 273 + 200 = 473 K

Pressure at inlet, P_{i} = 80 kPa = 80\times 10^{3} Pa

Pressure at outlet, P_{o} = 800 kPa = 800\times 10^{3} Pa

Speed at the outlet, v_{o} = 20 m/s

Diameter of the tube, D = 10 cm = 10\times 10^{- 2} m = 0.1 m

Input power, P_{i} = 400 kW = 400\times 10^{3} W

Now,

To calculate the heat transfer, Q, we make use of the steady flow eqn:

h_{i} + \frac{v_{i}^{2}}{2} + gH  + Q = h_{o} + \frac{v_{o}^{2}}{2} + gH' + p_{s}

where

h_{i} = specific enthalpy at inlet

h_{o} = specific enthalpy at outlet

v_{i} = air speed at inlet

p_{s} = specific power input

H and H' = Elevation of inlet and outlet

Now, if

v_{i} = 0 and H = H'

Then the above eqn reduces to:

h_{i} + gH + Q = h_{o} + \frac{v_{o}^{2}}{2} + gH + p_{s}

Q = h_{o} - h_{i} + \frac{v_{o}^{2}}{2} + p_{s}                (1)

Also,

p_{s} = \frac{P_{i}}{ mass, m}

Area of cross-section, A = \frac{\pi D^{2}}{4} =\frac{\pi 0.1^{2}}{4} = 7.85\times 10^{- 3} m^{2}

Specific Volume at outlet, V_{o} = A\times v_{o} = 7.85\times 10^{- 3}\times 20 = 0.157 m^{3}/s

From the eqn:

P_{o}V_{o} = mRT_{o}

m = \frac{800\times 10^{3}\times 0.157}{287\times 473} = 0.925 kg/s

Now,

p_{s} = \frac{400\times 10^{3}}{0.925} = 432.432 kJ/kg

Also,

\Delta h = h_{o} - h_{i} = c_{p}\Delta T =c_{p}(T_{o} - T_{i}) = 1.005(200 - 20) = 180.9 kJ/kg

Now, using these values in eqn (1):

Q = 180.9 + \frac{20^{2}}{2} + 432.432 = 813.33 kW

Now, rate of heat transfer, q:

q = mQ = 0.925\times 813.33 = 752.33 kW

4 0
3 years ago
Not sure which one....
Airida [17]
I think downwards as that's how most saw's work.
4 0
3 years ago
Need help solving math problem using integration
notka56 [123]
Ummm did you try to add or subtract and multiply or divide that can get your answer
8 0
2 years ago
¿Qué es la masonería?​
timofeeve [1]

Answer: freemasonry is Being a Mason is about a father helping his son make better decisions; a business leader striving to bring morality to the workplace; a thoughtful man learning to work through tough issues in his life.

Explanation:

3 0
3 years ago
Other questions:
  • In some synchronizer applications, the clock frequency f is substituted for the parameter a in metastability MTBF calculations,
    12·1 answer
  • Kirchoff's Law states that, by the time current has returned to its source, all
    13·2 answers
  • Show that the solution of thin airfoil theory of a symmetric airfoil given below satisfies the Kutta condition. What angle of at
    11·1 answer
  • Which sentence about the technology design process is true
    12·1 answer
  • What is pneumatic troubleshooting
    6·1 answer
  • SEICUL UC CULTELL allsvel.
    9·2 answers
  • Do you know who Candice is
    8·2 answers
  • How do you build a house.
    15·1 answer
  • ───────────────────────────────
    7·1 answer
  • When starting up a dual fuel system, the temperature rise method for determining airflow cannot be used with the compressor cycl
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!