The following equations estimate the calories burned when exercising (source): Men: Calories = [(Age x 0.2017) — (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969] x Time / 4.184 Women: Calories = [(Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022] x Time / 4.184 Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes). Output calories burned for men and women. Ex: If the input is: 49 155 148 60 Then the output is: Men: 489.7772466539196 calories Women: 580.939531548757 calories

Respuesta :

tanoli

Answer:

Program is in C++ programming language.

Explanation:

Below is the code that will output the men and women burned calories.

NOTE: the comments will describe what is going on in the code.

 

#include <bits/stdc++.h>  

using namespace std;  

 

int main() {  

// Declaring all the required fields

int age;

int time;

int weight;

int heartRate;

// get input from user on command prompt, this will allow user to enter  

// every value seperated by space and in exact order

cin>>age>>weight>>heartRate>>time;

//calculating the men calories

double menResult = (((age * 0.2017) - (weight * 0.09036)  

+ (heartRate * 0.6309) )- 55.0969)* time / 4.184;

// calculating the women calories

double womenResult = ((age * 0.074) - (weight * 0.05741) + (heartRate * 0.4472) - 20.4022) * time / 4.184;

// Output men calories

cout <<"Men Calories :"<<menResult<<endl;

// Output women caloris  

cout <<"Women Calories :"<<womenResult;

  return 0;

}

Answer:

age_years = int(input())

weight_pounds = int(input())

heart_bpm = int(input())

time_seconds = int(input())

calories_woman = ((age_years * 0.074) - (weight_pounds * 0.05741) + (heart_bpm * 0.4472) - 20.4022 ) * time_seconds / 4.184

calories_man = ((age_years * 0.2017) + (weight_pounds * 0.09036) + (heart_bpm * 0.6309) - 55.0969 ) * time_seconds / 4.184

print('Women: {:.2f} calories'.format(calories_woman))

print('Men: {:.2f} calories'.format(calories_man))

Explanation: