954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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

Basketball: 8 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.

infamous1987
Newbie Poster
4 posts since Feb 2012
Reputation Points: 10
Solved Threads: 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 Master Poster
620 posts since Sep 2008
Reputation Points: 258
Solved Threads: 117
 

Please read the rules here.
7. Do not ask for code. We are not a coding service. We will help you fix your code.
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
Solved Threads: 1
 

the weight value?

infamous1987
Newbie Poster
4 posts since Feb 2012
Reputation Points: 10
Solved Threads: 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 Master Poster
620 posts since Sep 2008
Reputation Points: 258
Solved Threads: 117
 

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
Solved Threads: 0
 

#include
using namespace std;

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

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



system ("pause");
return 0;
}

infamous1987
Newbie Poster
4 posts since Feb 2012
Reputation Points: 10
Solved Threads: 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
158 posts since May 2008
Reputation Points: 16
Solved Threads: 18
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You