Question
Write a program inputting three different measurements for a user specified number of people. The program must display the average heart rate of each person
Write a program inputting three different measurements for a user specified number of people. The program must display the average heart rate of each person and the average heart rate of all people when exercising, resting and sleeping. Must use a 2D array for this program. Number of people the user enters will determine the number of rows in the array. Each row in the array will contain three measurements. The first column of the array will contain the heart rate while exercising. The second column will contain the heart rate while resting. The third column will contain the heart rate while sleeping. Must use Java. Can not use methods/functions - create with beginner level/simple java skills.
Any value less than or equal to 0 should invalid and cause an error message to be displayed and the user to re-enter the data.
Display average with 1 digit after decimal point
Example Program
How many people are in the study? 5 Person 1: Exercise Heart Rate: 165 Resting Heart Rate: 65 Sleeping Heart Rate: 55 Person 2: Exercise Heart Rate: 178 Resting Heart Rate: 68 Sleeping Heart Rate: 57 Person 3: Exercise Heart Rate: 187 Resting Heart Rate: 78 Sleeping Heart Rate: 56 Person 4: Exercise Heart Rate: 167 Resting Heart Rate: 87 Sleeping Heart Rate: 54 Person 5: Exercise Heart Rate: 145 Resting Heart Rate: -55 Input error: Heart rate must be a number > 0 Resting Heart Rate: 55 Sleeping Heart Rate: 45 Average Heart Rate of Person 1: 95.0 Average Heart Rate of Person 2: 101.0 Average Heart Rate of Person 3: 107.0 Average Heart Rate of Person 4: 102.7 Average Heart Rate of Person 5: 81.7 Average exercising heart rate: 168.4 Average resting heart rate: 70.6 Average sleeping heart rate: 53.4
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