Question: write a c++ program A research institute specializing in physiology is conducting a study on the strain and effects of commuting trips done on a
write a c++ program
A research institute specializing in physiology is conducting a study on the strain and effects of commuting trips done on a bicycle or walking. When the physiological strain of commuting trips has been studied, the results will be used in exercise prescriptions, which can then use commuting as part of an exercise regimen.
In this program you will write a C++ program to analyze a small subset of the data that has been collected.
INPUT: Redirect the input from the file HR.txt
.
The file consists of three columns, with six lines of data for each person.
The first line stores:
i. column 1 - each persons ID number (integer),
ii. column 2 - clinically measured maximum heart rate (integer), and
iii. column 3 - age (integer).
For the following five lines, each contains:
(a) column 1 - the days average commuting heart rate
(b) column 2 - maximum commuting heart rate, and
(c) column 3 - exercise heart rate
for five consecutive working days.
Then, the six line sequence is repeated for the next person.
At times the heart rate monitors reacted to nearby power lines or other objects, and gave false readings. These incorrect measurements were rejected and show up in the data file as -1. On the days the person did not exercise, the exercise heart rate value is zero.
PROCESSING: Use precisely six parallel arrays: one for subject numbersand five for the calculated values as described below.
Using this information, calculate
Weekly average of the average(daily) commuting heart rates for each person.
Number of days that the person exercised on his/her own.
Estimated maximum heart rate = 220 age.
Ratio (%) of measured maximum heart rate to estimated maximum heart rate. The maximum heart rate for each person has been measured during a maximum oxygen uptake test in the laboratory. During the test, the person exercised with increasing intensity until exhaustion, and then the maximum heart rate was measured close to the end of the test. Using this measured maximum heart rate(column 2 of line 1) and the estimated maximum heart rate(calculation #3 above), calculate the ratio, in percentage, of the measured maximum heart rate to the estimated maximum heart rate. Note that this percentage can exceed 100%.
Ratio (%) of highest commuting heart rate of the week to measured maximum heart rate(done in the lab). Find the highest maximum commuting heart rate of the week(search through each day's maximum commuting heart rate) for each person, and then calculate the percentage of this value with respect to the measured maximum heart rate.
OUTPUT: Output should be in the following format and sorted by subject number from low to high:
COMMUTING AND EXERCISE HEART RATE SUMMARY
SUBJECT AVERAGE DAYS ESTIMATED %MEASURED %MAX NUMBER COMMUTING EXERCISED MAX HR TO COMMUTING HR ESTIMATED HR TO MAX HR MEASURED
XXXX XXX.X X XXX XXX.X XXX.X
THEME ISSUES: one-dimensional arrays, nested loops, if statements, selection sort, file input, file output
How you should do this:
| STEP 1 | Write main() and open file. Debug. |
| STEP 2 | Write get_data(). At this stage there is a for loop to read data for each of five days and the for loop is nested inside a while(not end of file) loop. Use debug cout statements to check that the data is being input correctly. These must be removed before final submission of project. Debug. |
| STEP 3 | Computations including function as stipulated. Debug. |
| STEP 4 | Write function to output heading. Debug. |
| STEP 5 | Write output function to output computed data. Debug. |
| STEP 6 | Write function to sort using selection method. Debug. |
| STEP 7 | When everything is working, clean up your code(remove dead code and comment out all test codes) and complete the documentation by following the same standard as stated in previous labs before. |
Checkpoints:
Input function fills all five arrays while calling calculation function. In this lab, in order not to make your task overburden, you are not required to separate input and calculation for this lab.
One and only one function must be used to calculate the percentage of measured maximum to estimated heart rate and the percentage of highest commuting heart rate to measure maximum heart rate
Use a selection sort to sort subject numbers. This needs to be a separate function.
A separate function must be used to output the table heading ONLY
Numerical output is done in a separate output function. Output must be formatted as shown. Output correct. Redirect output to a file.
You must have sufficient, meaningful comments in main() and all functions. Grading on your work will weigh more than ever on:
i. the quality and quantity of your comments;
ii. architecture and structural segmentation of your code;
iii. nomenclature;
iv. overall readability
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
