Question: Write a C++ program to analyze a small subset of the data that has beencollected. INPUT: Redirect the input from the file HR.txt.The file consists
Write a C++ program to analyze a small subset of the data that has beencollected.
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 eachpersons 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 heartrate, and exercise heart rate for five consecutive working days. Then, the six line sequence is repeatedfor 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 calculatedvalues as described below.
Look at data for subject 4545 as this is discussed:
4545 190 52114.8 130 113.1102.6 131 0.0117.4 129 149.1-1 -1 114.0114.1 123 119.5 Using this information, calculate1. 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 daythat 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 maximumoxygen uptake test in the laboratory. During the test, the person exercised withincreasing intensity until exhaustion, and then the maximum heart rate was measuredclose to the end of the test. Using this measured maximum heart rate and the estimatedmaximum heart rate, calculate the percentage of the measured maximum heart ratewith respect to the estimated maximum heart rate. Note that this percentage canexceed 100%. For subject 4545, 190/168 * 100 = 113.1%
5. Ratio (%) of highest commuting heart rate to measured maximum heart rate. Find the highestmaximum commuting heart rate for a person, and then calculate the percentage of this valuewith 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 SUMMARYSUBJECT AVERAGE DAYS ESTIMATED %MEASURED %MAXNUMBER COMMUTING EXERCISED MAX HR TO COMMUTING HR ESTIMATED HR TO MAX HR MEASURED XXXX XXX.X X XXX XXX.X XXX.X
Checkpoints:
No two-dimensional arrays, no menu function, and no structures may be used
1. Input function fills all five arrays while calling calculation function for each subject.
2. 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
3. Use a selection sort to sort subject numbers. This needs to be a separate function.
4. A separate function must be used to output the table heading ONLY
5. Numerical output is done in a separate output function. Output must beformatted as shown. Redirect output to a file.
Contents of HR.txt:
6231 181 28140.1 170 101.8128.4 156 0.0145.2 171 106.2131.3 165 0.0144.8 170 0.01124 178 36122.8 139 138.4119.6 142 0.0117.8 134 133.4115.3 145 134.287.2 109 120.57345 195 36128.4 151 104.6120.5 153 0.0134.5 166 140.4127.4 156 0.0150.3 169 158.59439 197 21121.5 143 112.2128.9 145 0.0126.1 159 134.5123.0 152 0.0131.5 147 0.04545 190 52114.8 130 113.1102.6 131 0.0117.4 129 149.1-1 -1 114.0114.1 123 119.52438 200 26123.0 165 105.4118.2 130 122.0121.7 136 124.5116.1 130 0.0111.0 152 103.52776 178 45110.3 120 129.1107.8 132 0.0111.5 145 135.0-1 -1 0.095.5 119 0.08762 186 28122.7 146 151.9116.0 137 0.0119.9 145 0.0123.3 148 150.0121.0 142 156.34915 185 27120.3 169 0.0130.2 150 0.0123.0 158 0.0133.4 152 0.0131.6 159 0.03521 181 51108.3 133 119.3-1 -1 0.0117.6 147 125.3106.7 131 0.0122.7 159 0.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
