Conversion of units?

Hi everyone,
we are supposed to be making a program on Metabolic Equivalents. where i input the activity, weight and pounds and the program outputs the calories. A Really straight forward program.

although I'm confused as to how to input this (1 kg = 2.2 pounds )
to be used in the equation for outputting calories

Calories/Minute = (.0175 * number METS * Weight (Kg) )

METS Signifies the activity
IE. Sleeping = 1 Mets
Walking = 2 Mets
Basketball = 8 Mets

Also, i was introduced to the if else statements and i was wondering if it would be better to just ask the activity used first and create a different calorie equation involving the different activities because they have different Mets? Or does it not really matter.
I think you've not thought enough about what you actually want to do.

How will the user enter the information? Will the user be restricted to entering the information using certain units (i.e. must be pounds or kg, or can the user choose)? Can the user enter any values at all, or will you be restricting the values?
The user would enter the information in pounds and I'm supposed to input the conversion but i don't know how to do so. I've only learned basic input and outputs.

i wanted the user to enter the weight first, then activity and then how long the user was doing the activity and then the program will calculate the calories burned. I know how to introduce the questions, but i don't understand how to put the equation in

for instance, in the user put walking as the activity and 80 minutes in.

Calories/Minute = (.0175 * number METS * Weight (Kg) ) this would be the equation and walking is 2 Mets so would i make a seperate equation for Walking??
closed account (D80DSL3A)
You could convert the weight right after the user enters the value in pounds:
1
2
3
double weight;
cout << "Enter weight in pounds: "; cin >> weight;
weight /= 2.2;// weight now converted to kilograms 


Try a switch statement to assign METS a value depending on the user input for activity, something like:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
char activity = 'n';// none as default
cout << "Enter activity as s, w, or b: "; cin >> activity;

double METS;
// assign a value to METS
	switch(activity)
	{
	case 's':
		METS = 1.0;
		break;
	case 'w':
		METS = 2.0;
		break;
	case 'b':
		METS = 8.0;
		break;
	default:
		METS = 0.0;// person is dead
	}


Get the time, use your equation and output the result = done!
int main()
{
cout << "This is a program to measure your MEtabolic Equivalents (METS) \n";
cout << "As well as the calories burned \n";
double weight;
cout << "To Begin enter weight in pounds: "; cin >> weight;
weight /= 2.2;
char activity = 'n';
cout << "Enter activity as s for sleeping, w for walking, or b basketball: "; cin >> activity;
double METS;
switch(activity)
{
case 's':
METS = 1.0;
break;
case 'w':
METS = 2.0;
break;
case 'b':
METS = 8.0;
break;
default:
METS = 0.0;
}
double minute;
cout << "Lastly now enter the time in minutes of the activity you were engaging: \n" ;
cin >> minute;
double calories;
calories = (.0175*METS*weight*minute);
cout << "You have burned \n"
<< "calories" << "Good Job!" ;
return 0;

}

This is the program and everything seems to be fine except for the calories doesn't show. I'm sure i have identified everything properly. what is wrong?

btw Thanks fun2code
closed account (D80DSL3A)
Your welcome for the help. You forgot to include the value of calories in that last cout statement. Try this instead:
1
2
cout << "You have burned \n"
<< calories << " calories. Good Job!" ; 
Topic archived. No new replies allowed.