/** A class used to keep track of student information @author Erika Harrison @version 1.0 24-06-02 */ public class Student { //tracks if the student went to the loan table private boolean toLoanTable = false; private boolean hasStats = false; //info on queue lengths private double totalQueueTime = 0; private double queueStartTime = 0; //determines the total time spent in the simulation private double startTime = 0; private double endTime = 0; public Student(double startTime) //pre: startTime = the time the student entered the system //post: a student is constructed { this.startTime = startTime; //determines if the given student will attend the OSAP table toLoanTable = Constants.toOSAP(); } public double getTotalTime() //pre: true //post: returns the current total time the student has spent in the system { return endTime - startTime; } public boolean toOSAPTable() //pre: true //post: returns whether or not the student will/has attended the OSAP table { return toLoanTable; } public void addToQueue(double startTime) //pre: startTime = the time the student entered the queue //post: student has been recorded the time added to the queue (for stats) { queueStartTime = startTime; } public void quit(double endTime) //pre: endTime = the time the student leaves the system //post: the endTime of the student is recorded (for stats purposes) { this.endTime = endTime; } public void doneQueue(double endTime) //pre: endTime = the time the student has left the queue //post: the amount of time spent in a line up has been incremented { if(endTime != startTime) { totalQueueTime += endTime - queueStartTime; } } public double getQueueTime() //pre: true //post: returns the total amount of time the student has spent in a line up { return totalQueueTime; } public boolean hasStats() //pre: true //post: returns if the student has valid statistics to be included { return hasStats; } public void recordStats() //pre: true //post: the student has valid statistics { hasStats = true; } }