Answer to Question #289965 in C++ for test

Question #289965

Calories = ( (Age x 0.2757) + (Weight x 0.03295) + (Heart Rate x 1.0781) — 75.4991 ) x Time / 8.368

Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output the average calories burned for a person.

Output each floating-point value with two digits after the decimal point, which can be achieved by executing

cout << fixed << setprecision(2); once before all other cout statements.


1
Expert's answer
2022-01-23T12:48:53-0500
#include<iostream>
#include<iomanip>

using namespace std;

int main()
{
	int age;
	cout << "Please, enter your age: ";
	cin >> age;
	float weight;
	cout << "Please, enter your weight: ";
	cin >> weight;
	int heartRate;
	cout << "Please, enter your heart rate: ";
	cin >> heartRate;
	int time;
	cout << "Please, enter a time: ";
	cin >> time;
	double calories = (double)((age*0.2752) + (weight*0.03295) + (heartRate*1.0781) - 75.4991)*time / 8.386;
	cout << fixed << setprecision(2)
		<< "You burned " << calories << "calories";
}	

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

stanley
07.11.23, 11:12

Thank for answering the question I was really stuck there

Leave a comment

LATEST TUTORIALS
New on Blog