PatientInflow - for (int hour = 0; hour < 24;...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//********************************************************************* // PatientInflow.java Author: Lewis and Loftus // // Solution to Programming Project 8.8 //********************************************************************* import java.io.*; import java.util.*; public class PatientInflow { //----------------------------------------------------------------- // Reads and processes hospital flow data. //----------------------------------------------------------------- public static void main (String[] args) { try { int datum; int[] weekly = new int[4]; int[] daily = new int[7]; int[] hourly = new int[24]; int[][][] patients = new int[24][7][4]; BufferedReader in = new BufferedReader ( new FileReader ( new File(args [0]))); StringTokenizer reader; // read data and calculate totals for (int week = 0; week < 4; week++) { for (int day = 0; day < 7; day++) { reader = new StringTokenizer (in.readLine());
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: for (int hour = 0; hour &lt; 24; hour++) { datum = Integer.parseInt (reader.nextToken()); patients [hour][day][week] = datum; hourly [hour] += datum; daily [day] += datum; weekly [week] += datum; } } in.readLine(); } // print the analysis results System.out.println (&quot;Per Week Of The Month:&quot;); for (int week = 1; week &lt;= 4; week++) System.out.println (week + &quot;:\t&quot; + weekly[week - 1]); System.out.println (&quot;Per Day Of The Week:&quot;); for (int day = 1; day &lt;= 7; day++) System.out.println (day + &quot;:\t&quot; + daily[day - 1]); System.out.println (&quot;Per Hour Of The Day:&quot;); for (int hour = 0; hour &lt; 24; hour++) System.out.println (hour + &quot;:\t&quot; + hourly[hour]); } catch (Exception ex) { ex.printStackTrace (System.err); System.out.println (&quot;Usage: java PatientInflow filename&quot;); } } }...
View Full Document

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 2

PatientInflow - for (int hour = 0; hour &amp;amp;lt; 24;...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online