16. Training Heart Rate in order for exercise to be beneficial to the cardiovasc
ID: 3761036 • Letter: 1
Question
16. Training Heart Rate in order for exercise to be beneficial to the cardiovascular system, the heart rate (number of heart heats per minute) must exceed a value called the training heart rate, THR. A person's THR can be calculated from his or her age and resting heart rare (pulse rate when first awakening) as follows: (a) Calculate the maximum heart 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 rare as input and display his or her THR. See Fig. 5.6.Explanation / Answer
The programming language is not mentioned, So I would use JAVA to perform this task and the logic will be same for all other languages. The program is a command line program without any GUI
Here is the JAVA Code with comments
import java.util.*;
class THR
{
public static void main(String args[])
{
int age;
double resting_heart_rate;
double thr;
Scanner scan=new Scanner(System.in);
System.out.println("Please Enter age");
age=scan.nextInt();
System.out.println("Please Enter Resting Heart Rate");
resting_heart_rate=scan.nextInt();
int max_hr=220-age; // Step a
double x=max_hr-resting_heart_rate; // Step b
x=0.6*x; // Step c Calculate 60% of x
thr=x+resting_heart_rate;
System.out.println("Your THR is "+ thr);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.