Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java program reading heart rates: I was given a file that has 5 text files with a bunch of integers for heart rates (if you

Java program reading heart rates:

I was given a file that has 5 text files with a bunch of integers for heart rates

image text in transcribed

(if you can, make a file with 5 text files with the following: (copy and paste) so that it can be read in the program.

text file 1: A bunch of heart rates: the first ones are 686 554 372 694 712 462 986 730 708 (just make 5 different text files and copy these integers into them so that they can be read, the real text files have many more numbers but i cannot fit them here)

text file 2:804 748 808 818 758 800 779 800 789 800

text file 3:714 696 688 682 666 710 702 688 334

text file 4: 934 914 938 952 952 848 844 850 834

text file 5:636 638 666 692 698 674 670 680 664 648

Inside the folder - you will see a number of text files. Each file contains the inter-beat intervalsalso known as RR intervals (fictional) for the particular participant. You are required to readthe values inside the given file for each participant. Your need is to compute the values of theHeart-rate (HR) of each participant using the RR intervals data in each file.

image text in transcribed

HR is the average number of heart beats per minute. To measure HR, you will need to computethe mean for all the values inside the text-file for each participant and later will use the followingformula to compute the value of the HR,

HR = (60 * 1000) / mean-value of the RR intervals for each participant.

For example if a file has 10 values of RR intervals, you compute the mean of those values anduse that mean value in the above formula to compute the HR.

Here, you will need to create a Participant class with the following fields to store their informa-tion and Heart-Rate values,

Participant ID (a String)

Date of Data Collection (a String with spaces)

Time of Data Collection (a String with spaces)

Heart Rate (a integer )

In Summary, your task is to write a Java program in the main method of the Participant classthat reads the list of files inside the given folder, read the text files and compute the HR foreach participant. Besides, for each participant, you need to assign a Participant ID of p1, p2,and so on respectively for each file. Also, you need to randomly assign the date and time toeach participant.Note that you will need to create an ArrayList of participants objects to store the values of eachparticipant. Once stored, you will need to write the participant information to the OUTPUT.txt file.The Output file will have participants details in the following fashion,

image text in transcribed

Your task is to extend your main method to create a menu for the user to interact with yourprogram. Your menu looks like this,

image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions