We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,348 Members — Technology Publication meets Social Media

need help with WRITING this code in C++ HELP!!!

One way to measure the amount of energy that is expended during exercise is to use metabolic equivalents (MET). Here are some METS for various activities;

Running 6 MPH: 10 METS

Sleeping: MET

The number of calories burned per minute may be estimated using the formula

Calories/Minute= 0.0175 X MET X Weight (Kg)

Write a program that inputs a subject's weight in pounds, the number of METS for an activity, and the number of minutes spent on that activitym and then outputs an estimate for the total number of calories burned. One kilogram is equal to 2.2 pounds.

5
Contributors
7
Replies
1 Week
Discussion Span
1 Year Ago
Last Updated
9
Views
infamous1987
Newbie Poster
4 posts since Feb 2012
Reputation Points: 10
Skill Endorsements: 0

Get weight value from user.
Get MET score for activity.
Get time spent doing activity.
Output (0.0175 * MET * time * weight/2.2)

Which of those can you not do?

Moschops
Practically a Posting Shark
889 posts since Sep 2008
Reputation Points: 297
Skill Endorsements: 5

If anyone posts a complete working solution for you, they are enabling cheaters.
If you use that code you are a cheater.

We can help you to show the path but you should write your own code. If you face any problem regarding your code you can share it. If you don't know coding you can learn it. Here are some reference books. You can find lots of free books and video tutorial for coding. If you ask for code that will not help you to learn How to Code.

tahsin.rahit
Newbie Poster
11 posts since Feb 2012
Reputation Points: 10
Skill Endorsements: 0

the weight value?

infamous1987
Newbie Poster
4 posts since Feb 2012
Reputation Points: 10
Skill Endorsements: 0

I'll take that to mean you don't know how to take in the weight value from the user. This is, as a general rule, one of the first things in the textbook or class notes. Here is how to get a value from the user:

``cin >> someVariable;``
Moschops
Practically a Posting Shark
889 posts since Sep 2008
Reputation Points: 297
Skill Endorsements: 5

If you are trying to prompt user for data, try this.

``````cout<<"please enter your data here";
cin>>dataVariable;``````
solarcoder
Newbie Poster
5 posts since Feb 2012
Reputation Points: 10
Skill Endorsements: 0
``````#include <iostream>
using namespace std;

int main()
{
int mets;
double fatnessKg, fatnessLb, energy, mins;

cout << "METS:\n"
<< "\tRunning: 6Mph = 10 METS\n"
<< "\tSleeping: MET\n";

system ("pause");
return 0;
}
``````
infamous1987
Newbie Poster
4 posts since Feb 2012
Reputation Points: 10
Skill Endorsements: 0
``````#include <iostream>

using namespace std;

int main()
{
double CAL,MET,MINS,WEI;

CAL = MET = MINS = WEI = 0;

cout<<"Enter you weight in pounds:";
cin>>WEI;

cout<<"Enter MET number:";
cin>>MET;

cout<<"Enter the duration in mins:";
cin>>MINS;

CAL = 0.0175 * MET * WEI/2.2;
CAL = CAL * MINS;
cout<<"Total Calories:"<<CAL<<endl;

return 0;

}``````
Software guy
Junior Poster
165 posts since May 2008
Reputation Points: 16