In the book An introduction to programming using visual basics 2012 edition, I a
ID: 3939754 • Letter: I
Question
In the book An introduction to programming using visual basics 2012 edition, I am looking for the solution to problem 16(Training Heart Rate) in chapter 5.1 The solution must incoportate a user defined function.
Training heart rate-In order for excercise to be benificial to the cardiovascular system, the heart rate(number of heart beats 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 rate (pulse rate when first awakening) as follows:
A.calculate 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 persons age and resting heart rate as input and display his or her THR.
Explanation / Answer
Hope this helps....
#include<bits/stdc++.h>
#define endl ' '
using namespace std;
int main()
{
cout<<"Please enter age"<<endl;
int age;
cin>>age;
cout<<"Please enter resting heart rate"<<endl;
int rhr;
cin>>rhr;
int mhr=220-age;
mhr-=rhr;
float finans=rhr+(mhr*0.6);
cout<<finans<<endl;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.