Question
The simplest way to do this following the step when I do i get errors. A research institute specializing in physiology is conducting a study
The simplest way to do this following the step when I do i get errors.
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 each persons ID number (integer), clinically measured maximum heart rate (integer), and age (integer). The following five lines contain the days average commuting heart rate, maximum commuting heart rate, and 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 numbers and five for the calculated values as described below.
Look at data for subject 4545 as this is discussed:
4545 190 52
114.8 130 113.1
102.6 131 0.0
117.4 129 149.1
-1 -1 114.0
114.1 123 119.5
Using this information, calculate
1. Average of the average commuting heart rates for each person. For subject 4545 this would be (114.8 + 102.6 + 117.4 + 114.1)/4 since there was a day that no reading was available.
2. Number of days that the person exercised on his/her own.
For subject 4545 this is 4 since one of the days is 0.
3. Estimated maximum heart rate = 220 age.
For subject 4545 this is 220 52 = 168
4. 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 and the estimated maximum heart rate, calculate the percentage of the measured maximum heart rate with respect to the estimated maximum heart rate. Note that this percentage can exceed 100%.
For subject 4545, 190/168 * 100 = 113.1%
5. Ratio (%) of highest commuting heart rate to measured maximum heart rate. Find the highest maximum commuting heart rate for a person, and then calculate the percentage of this value with respect to the measured maximum heart rate. For subject 4545, 131/ 190 = 69.4%
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
SAMPLE:
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
1124 112.5 4 184 96.7 81.5
THEME ISSUES: one-dimensional arrays, nested loops, if statements, file input, file output
How should you do this? STEP 1 | Write main() and open file. Debug. |
STEP 2 | Write getdata(). At this stage there is a for loop to read each of five days nested inside a while not end of file type 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. Debug. |
STEP 6 | Write function to sort using selection method. Debug. |
STEP 7 | "Doll up" the program documentation. Debug (just in case) |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started