Question: abstract class Patient implements the Comparable interface for Patient Has a public static int variable idCounter set to 0 . Has int instance variables arrivalTimeAtEmergencyFacility,
abstract class Patient implements the Comparable interface for Patient
Has a public static int variable idCounter set to
Has int instance variables arrivalTimeAtEmergencyFacility, doctorStartTime, waitTime, examDuration,
totalTimeAtEmergencyFacility
Has a String instance variable patient Type
Has a single constructor with a parameter for arrival Time which
Calls setArrivalTimeAtEmergencyFacility with the arrivalTime from the constructor as the
parameter
There are simple accessor getXXX methods for each of the six instance variables
The mutator method for setArrivalTimeAtEmergencyFacility accepts an int parameter and has a void
return
It sets the arrivalTimeAtEmergencyFacility equal to the input parameter value
The mutator method for setExamDuration accepts an int parameter and has a void return
It sets the examDuration equal to the input parameter value
The setDoctorStartTime accepts an int with the doctorStartTime as the parameter and has a void return
It sets the doctorStartTime equal to the input parameter
It sets the waitTime as the difference between the doctorStartTime and the
arrivalTimeAtEmergencyFacility
The setTotalTimeAtEmergencyFacility method accepts an int with the endTime as a parameter and has
a void return
It sets the totalTimeAtEmergencyFacility to the difference between the endTime and the
arrivalTimeAtEmergencyFacility
The setPatientType method accepts a String reference to the patientType as the parameter and has a void
return
It sets patientType to the parameter a reference variable
There are the following abstract methods:
setPatientID has no parameters and a void return
getPatientID has no parameters and returns a String
compareTo has a reference to a Patient as a parameter and returns an int this is the method from
Comparable, but it is given a coded body in each of the subclasses, not here. In fact it does not even need
to be stated hereclass UrgentPatient is a subclass of Patient
Has a String instance variable patientID
Has a single constructor with an int parameter indicating the arrivalTime
Calls super with arrivalTime as the parameter
Calls setPatientType with "URGENT" as the parameter
Calls setPatientID with no parameters
There is a normal accessor getPatientID that overrides the abstract version of this method
setPatientID has no parameters and a void return this is an override of the abstract method setPatientID
It increments the static variable idCounter declared in Patient
It sets patientID to the concatenation of the patientType, and the Patient.idCounter
Note: a patientID might look like this URGENT
compareTo has a reference to a Patient as a parameter and returns an int this is an override of the
abstract method in Patient
Returns an int based on a reversal of the natural order for the String patientType. ie URGENT
will precede SEVERE which precedes NOMINAL.
Note: compareTo will be used in PatientPriority
class SeverePatient is a subclass of Patient
Has a String instance variable patientID
Has a single constructor with an int parameter indicating the arrivalTime
Calls super with arrivalTime as the parameter
Calls setPatientType with "SEVERE" as the parameter
Calls setPatientID with no parameters
There is a normal accessor getPatientID that overrides the abstract version of this method
setPatientID has no parameters and a void return this is an override of the abstract method setPatientID
It increments the static variable idCounter declared in Patient
It sets patientID to the concatenation of the patient Type, and the Patient.idCounter
Note: a patientID might look like this SEVERE
compareTo has a reference to a Patient as a parameter and returns an int this is an override of the
abstract method in Patient
Returns an int based on a reversal of the natural order for the String patientType. ie URGENT
will precede SEVERE which precedes NOMINAL.
Note: compareTo will be used in PatientPriorityclass Nominal is a subclass of Patient
Has a String instance variable patientID
Has a single constructor with an int parameter indicating the arrivalTime
Calls super with arrivalTime as the parameter
Calls setPatientType with "NOMINAL" as the parameter
Calls setPatientID with no parameters
There is a normal accessor getPatientID that overrides the abstract version of this method
setPatientID has no parameters and a void return this is an override of the abstract method setPatientID
It increments the static variable idCounter declared in Patient
It sets patientID to the concatenation of the patientType, and the Patient.idCounter
Note: a patientID might look like this NOMINAL
compareTo has a reference to a Patient as a parameter and returns an int this is an override of the
abstract method in Patient
Returns an int based on a reversal of the natural order for the String patientType. ie URGENT
will precede SEVERE which precedes NOMINAL.
Note: compareTo will be used in PatientPriority
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
