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]
2 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]2 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
What are the two reasons for a clear cut
Inessa [10]

Answer:

to clear land for agriculture and settlement and to use or sell timber for lumber, paper products, or fuel.

3 0
2 years ago
Rubber bushings are used on suspensions to
Harlamova29_29 [7]
D. All of the above
4 0
3 years ago
A police officer in a patrol car parked in a 70 km/h speed zone observes a passing automobile traveling at a slow, constant spee
Ludmilka [50]

Answer:

S = 0.5 km

velocity of motorist = 42.857 km/h

Explanation:

given data

speed  = 70 km/h

accelerates uniformly = 90 km/h

time = 8 s

overtakes motorist =  42 s

solution

we know  initial velocity u1 of police = 0

final velocity u2 = 90 km/h = 25 mps

we apply here equation of motion

u2 = u1 + at  

so acceleration a will be

a = \frac{25-0}{8}

a = 3.125  m/s²

so

distance will be

S1 = 0.5 × a × t²

S1 = 100 m = 0.1 km

and

S2 = u2 ×  t

S2 = 25  × 16

S2 = 400 m = 0.4 km  

so total distance travel by police

S = S1 + S2

S = 0.1 + 0.4

S = 0.5 km

and

when motorist travel with  uniform velocity

than total time = 42 s

so velocity of motorist will be

velocity of motorist = \frac{S}{t}

velocity of motorist =  \frac{500}{42}  

velocity of motorist = 42.857 km/h

3 0
3 years ago
python Write a program that asks a user to type in two strings and that prints •the characters that occur in both strings. •the
Yuliya22 [10]

Answer:

see explanation

Explanation:

#we first get the elements as inputs

x = input("enter string A :")

y = input("enter string B :")

#then we make independent sets with each

x = set(x)

y = set(y)

#then the intersection of the two sets

intersection = set.intersection(x,y)

#another set for the alphabet

#we use set.difference to get the elements present in x and not in y, and

#viceversa, finally we get the difference between the alphabet and the #intersection of the elements in our strings

z = set('abcdefghijklmnopqrstuvwxyz')

print('\nrepeated :\n',intersection)

print('differences :\n',' Items in A and not B\n',

set.difference(x,y),'\nItems in B and not A\n',

set.difference(y,x))

print('\nItems in neither :\n',set.difference(z,intersection))

8 0
3 years ago
Use the scoring system described to calculate the alignment score for These are two lines of 14 letters aligned with each other.
PtichkaEL [24]

Answer:

do good

Explanation:

get that money

7 0
3 years ago
Other questions:
  • A dipstick is (a direct,an indirect) measurement device
    13·1 answer
  • A fluid has a dynamic viscosity of 0.048 Pa.s and a specific gravity of 0.913. For the flow of such a fluid over a flat solid su
    10·1 answer
  • What is the reason for the development of new construction of materials for human use? (Select all that apply.)
    12·1 answer
  • What the Best describes the purpose of the occupational safety and health administración OSHA
    12·1 answer
  • The mechanical properties of a metal may be improved by incorporating fine particles of its oxide. Given that the moduli of elas
    5·1 answer
  • Complete the following sentence. The skills and content of several subject areas were combined to form a new field known as a me
    12·2 answers
  • Which of the following is true of dead zones? a. They are formed when a volcanic eruption covers the soil with ash. b. They are
    15·1 answer
  • The convection heat transfer coefficient for a clothed person standing in moving air is expressed as h 5 14.8V0.69 for 0.15 , V
    6·2 answers
  • Fixed rate mortgage offer:
    9·2 answers
  • A composite plane wall consists of a 5-in.-thick layer of insulation (ks = 0.029 Btu/h*ft*°R) and a 0.75-in.-thick layer of sidi
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!