m865.simulation
Class Statistician

java.lang.Object
  extended by m865.simulation.Statistician

public class Statistician
extends java.lang.Object

This is a Statistician class which performs all the necessary calculations based on the inputs taken from the passengers and and presents to the departmentStore a report on the day's events.


Field Summary
protected  double longestTravel
           
protected  double longestWait
           
protected  int numberBalked
           
protected  double overallAvgTravelSum
           
protected  double overallAvgWaitSum
           
protected  int passengerCount
           
 
Constructor Summary
Statistician()
          Default constructor for the statistician class
 
Method Summary
 double average(double sum, int count)
          This method calculates the average time
 void extremeValues(double travel1, double travel2, double travel3, double wait1, double wait2, double wait3)
          This method determines the longest wait and travel time encountered by a shopper
 void generateReport()
          This method generates the report.
static void main(java.lang.String[] args)
          Statistician Main method
protected  void recordPassengerInfo(Passenger passenger)
          This method receives the information from the each of the passengers and updates the number of passengers, the number of balking passengers, sum of the transit times, sum of the waiting times, etc.
 java.lang.String toString()
          toString method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

passengerCount

protected int passengerCount

numberBalked

protected int numberBalked

overallAvgWaitSum

protected double overallAvgWaitSum

overallAvgTravelSum

protected double overallAvgTravelSum

longestWait

protected double longestWait

longestTravel

protected double longestTravel
Constructor Detail

Statistician

public Statistician()
Default constructor for the statistician class

Method Detail

recordPassengerInfo

protected void recordPassengerInfo(Passenger passenger)
This method receives the information from the each of the passengers and updates the number of passengers, the number of balking passengers, sum of the transit times, sum of the waiting times, etc.

Parameters:
passenger - The passenger

average

public double average(double sum,
                      int count)
This method calculates the average time

Parameters:
double - totalTimeTraveled
int - numerOfTimesTraveled

extremeValues

public void extremeValues(double travel1,
                          double travel2,
                          double travel3,
                          double wait1,
                          double wait2,
                          double wait3)
This method determines the longest wait and travel time encountered by a shopper

Parameters:
double - travel1 travel2 travel3
double - wait1 wait2 wait3

generateReport

public void generateReport()
This method generates the report. It prints The number of passengers The number of balked passengers etc., etc.


toString

public java.lang.String toString()
toString method

Overrides:
toString in class java.lang.Object
Returns:
String

main

public static void main(java.lang.String[] args)
Statistician Main method