Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your task is to design a program to help a hospital analyze the ow of patient arrivals in their emergency room. Atextlecontainspatientarrivals7daysaweek,24hoursadayfor4weeks. Eachvaluerepresents the number

Your task is to design a program to help a hospital analyze the ow of patient arrivals in their emergency room. Atextlecontainspatientarrivals7daysaweek,24hoursadayfor4weeks. Eachvaluerepresents the number of patients that entered the emergency room during a given hour. Each row in the data le contains 24 values, one for each hour in the day, for all 7 days of the week. Each row contains 24*7 or 168 values. The rst set of values in each row is for day zero or Sunday of each week. Each hour is based on military time with hour 0 being 12am,and hour 23 being 11pm.

Requirements Read data from a text le into a 3 dimensional array. From the data,compute: 1. the total number of patients that entered the emergency room per week 2. the total number of patients that entered the emergency room per day for each week 3. the average number of daily patient visits per week 4. the number of patient visits per day,averaged overall weeks 5. the busiest day for each week 6. the least busy day for each week. Each of these requirements directly corresponds to a function you must implement. See the following section on Specications for more details

Specications Implement the ERDataReader.java and ERDataAnalyzer.java modules according to the predened class methods. These predened class methods serve as the public API (application program interface) for your modules. You are not permitted to change the existing skeleton of class and method declarations. However, you are encouraged to create additional private methods to help simplify the process of implementing the public interface. The ERDataReader and ERDataAnalyzerclasses exist in the er_datapackage

Reading the data Implement the readData() function of the ERDataReader module. The readData function does not need to perform any exception handling. In its function declaration, it species what exceptions it may throw. It willbe the responsibility of other programs which use,or "consume,"this function to handle those exceptions. The ERDataReadermodule must have the following signature:

1 public class ERDataReader {

2 public static int[][][] readData(String dataFile)

3 throws FileNotFoundException, NoSuchElementException, IllegalStateException -

{}

4 }

Implement ERDataAnalyzer class interface with the following public methods:

1 public class ERDataAnalyzer {

2 public static int[] patientsPerWeek(int[][][] data) {}

3 public static int[][] patientsPerDayPerWeek(int[][][] data) {}

4 public static double[] averagePatientsPerWeek(int[][][] data) {}

5 public static double[] averagePatientsPerDayAcrossWeeks(int[][][] data) {}

6 public static int[] busiestDayPerWeek(int[][][] data) {}

7 public static int[] leastBusyDayPerWeek(int[][][] data) {}

8 }

Example

1 import er_data.ERDataReader;

2 import er_data.ERDataAnalyzer;

3 import java.io.FileNotFoundException;

4

5 public class Assignment1 {

6 public static void main(String[] args){

7 String dataFile = "path/to/data";

8

9 int[][][] data = // initialize array

10 try {

11 data = ERDataReader.readData(dataFile);

12 } catch (FileNotFoundException e) {

13 System.err.println("File cannot be found or accessed: " + dataFile);

14 } catch (Exception e) {

15 e.printStackTrace();

16 }

17

18 int[] patientsPerWeek = ERDataAnalyzer.patientsPerWeek(data);

19 System.out.println("Patients per week: " + patientsPerWeek);

20 // Calls to other ERDataAnalyzer functions...

21 }

22 }

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

More Books

Students also viewed these Databases questions

Question

1. What are the major sources of stress in your life?

Answered: 1 week ago