Question: INSTRUCTIONS: 1. Your task is to write a C++ program which computes a set of target heart rate values associated with human exercise research. The

INSTRUCTIONS:

1. Your task is to write a C++ program which computes a set of target heart rate values associated with human exercise research.

The formulas you will need can be found on the following web page: http://en.wikipedia.org/wiki/Heart rate

2. Your program should prompt the user for two integers, the subjects age in years (age) and the subjects resting heart rate in beats per minute (HRrest), then compute and display the integer-valued maximal safe heart rate for this individual using ( HRmax = 205.8 (0.685 age) ), the 85% intensity target heart rate (T HR85) based upon the Karvonen method, and the heart rate reserve (HRR).

NOTE: Your program should conduct a simple validation of the input data (only positive inputs are allowed: the subject must be older than 0 years and have a resting heart rate greater than 0).

3. To get you started on the program design, we provide a minimal main(), stubby function/procedure template for this program as shown at the top of the third page.

(a) Your job is to complete the implementations (fill in the stubby bodies) of the functions.

(b) You are strongly encouraged to proceed one step at a time in this process, compiling and testing each function implementation before proceeding to the next function.

GIVEN CODE:

// Compute several exercise related heart rate targets based upon age and

// resting heart rate. // Reference: see HRmax, HRR and THR on http://en.wikipedia.org/wiki/Heart_rate

void DisplayIntroduction(void); int PromptForAge(void); int PromptForHRrest(void); int ComputeHRmax(int age); int ComputeHRR(int age, int HRrest); int ComputeTHR85(int age, int HRrest); void DisplayResults(int HRMax, int HRR, int THR85);

int main() { int age, HRrest; int HRmax, HRR, THR85;

DisplayIntroduction(); age = PromptForAge(); HRrest = PromptForHRrest();

HRmax = ComputeHRmax(age); HRR = ComputeHRR(age, HRrest); THR85 = ComputeTHR85(age, HRrest); DisplayResults(HRmax, HRR, THR85);

return 0; }

// Stubby implementations. // These need lots of work! void DisplayIntroduction(void) {return; } int PromptForAge(void) {return 1;} int PromptForHRrest(void) {return 1;} int ComputeHRmax(int age) {return 1;} int ComputeHRR(int age, int HRrest) {return 1;} int ComputeTHR85(int age, int HRrest) {return 1;} void DisplayResults(int HRMax, int HRR, int THR85) {return;}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!