Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In order for excercise to be beneficial to the cardiovascular system, the heart

ID: 672116 • Letter: I

Question

In order for excercise to be beneficial to the cardiovascular system, the heart rate (number of hear beats per minute) must exceed a value called the training hear reate, THR. A person's THR can be calculated from his or her age and resting heart rate (pulse rate when first awakening) as follows :

(a) calculate the maximum hear rate as 220-age.

(b) subtract the resting heart rate from the maximum heart rate

(c) multiply the result in step (b) by 60% and then add the resting heart rate.

write a program to request a person's age and resting heart rate as input and display his or her THR.

Explanation / Answer

Please find the program written in C++ as per the requirement:

#include <iostream>
using namespace std;

int main() {
   int age,restingHR, maxHR;
   float THR;
  
   cout<<"Please enter Age and Resting Heart Rate";
   cin>>age>>restingHR;
   cout<<endl;
  
   while ((age <= 0) or (restingHR <= 0)){
cout << "Invalid Values. Please enter valid values greater than zeros: "<<endl;
cin>>age>>restingHR;
   }
  
maxHR = 220 - age;
THR = (maxHR - restingHR)*0.6 + restingHR;
  
cout<<"Training Heart Rate THR is: "<<THR<<endl;
  
   return 0;
}

Testing:

Input:

40 77

Output:

Training Heart Rate THR is: 138.8

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote