Question: In Java, main help with vaccinateNextPatient and administerAvailableDoses methods, here are the other files for context: Patient.java public class Patient { private String name ;

 In Java, main help with vaccinateNextPatient and administerAvailableDoses methods, here are

the other files for context: Patient.java public class Patient { private String

name ; // Patient Name private int age ; //Patient Age private

In Java, main help with vaccinateNextPatient and administerAvailableDoses methods, here are the other files for context:

Patient.java

public class Patient { private String name ; // Patient Name private int age ; //Patient Age private HealthID id ; //Code ID Patients private boolean vaccinated ; // Finds out if patient is vaccinated public Patient(String patientName , int patientAge , HealthID code) { //Initializing the name age and id of the patient plus setting the patients vaccine status to false name = patientName ; age = patientAge ; id = code ; vaccinated = false ; } public void setName(String name) { this.name = name; //Mutator } public int getAge() { return age; // Mutator } public void setAge(int age) { this.age = age; //Mutator } public void setIdCode(HealthID id) { this.id = id; // Mutator } public String toString() { return name+ "(" + age + "), " + id+ ", Vaccinated:" +vaccinated ; //Object string } public boolean equals(Patient compare) { return id.equals(compare.id); //If two patients have the same id this method indicates them as same patient } public boolean isVaccinated() { return vaccinated ; //Returns whether the patient is vaccinated or not } public HealthID getHealthID() { return id ; //Muttator } public String getName() { return name; // Muttator } public void vaccinate() { vaccinated = true ; //This method will vaccinate a patient } } 
HealthID.java 
public class HealthID { private int familyNumber ; //HealthID familyNumber private int pin ; // healthID pin private static int nextFamilyNumber = 1000 ; //familyNumbers start from 1000 private static int nextPin = 100000000 ; //pin numbers start from 100000000 public HealthID() { // This constructor is used to call on a HealthID of someone with the same family familyNumber= newFamilyNumber ; //Initializes familyNumber to 1000 pin = nextPin ; //Pin number starts at 100000000 nextPin++ ; //Calling constructor increments the pin number } public HealthID(int newFamilyNumber) { //This constructor establishes new familyNumber familyNumber = newFamilyNumber; pin = nextPin ; nextPin++ ; //Pin is still incremented nextFamilyNumber++ ; //This constructor now increments the familyNumber } public int getFamilyNumber() { return familyNumber; //Muttator } public int getPIN() { return pin ; //Muttator } public String toString() { return familyNumber+ ":" +pin ; //The HealthID string appearance } public boolean equals(HealthID lookFor) { return familyNumber == lookFor.familyNumber && pin == lookFor.pin ; //Both the pin and familyNumber have to be equal to be equal HealthID's } public boolean sameFamily(HealthID loofForFamily) { return familyNumber == lookForFamily.familyNumber ; //Looking for the same familyNumber } } 

TestPhase2.java

public class TestPhase2 { public static void main(String[] args) { // 3 Health IDs HealthID id1; HealthID id2; HealthID id3; // 3 patients Patient alice; Patient bob; Patient yuwei; // Instantiate the ids and patients id1 = new HealthID(); alice = new Patient("Alice", 68, id1); id2 = new HealthID(alice.getHealthID().getFamilyNumber()); bob = new Patient("Bob", 70, id2); id3 = new HealthID(); yuwei = new Patient("Yuwei", 24, id3); HealthID id4 = new HealthID(); HealthID id5 = new HealthID(); HealthID id6 = new HealthID(id5.getFamilyNumber()); Patient liqun = new Patient("Liqun", 25, id4); Patient ananta = new Patient("Ananta", 35, id5); Patient taylor = new Patient("Taylor", 30, id6); //Create two clinics and try out scheduling and vaccinating int dosesToWinnipeg = 3; int dosesToBrandon = 2; VaccineClinic winnipegClinic = new VaccineClinic("Winnipeg Supersite", 3); System.out.println(winnipegClinic); winnipegClinic.displayPatientsWaiting(); //Scheduling some patients and displaying their place in the queue System.out.println(" Scheduling alice, liqun, bob at the Winnipeg clinic"); System.out.println("Alice is in position: " + winnipegClinic.schedulePatient(alice)); System.out.println("Liqun is in position: " + winnipegClinic.schedulePatient(liqun)); System.out.println("Bob is in position: " + winnipegClinic.schedulePatient(bob)); System.out.println(winnipegClinic); winnipegClinic.displayPatientsWaiting(); // Trying to schedule a patient at the Winnipeg clinic System.out.println(" Trying to schedule Ananta at the Winnipeg clinic"); System.out.println("Ananta is position: " + winnipegClinic.schedulePatient(ananta)); System.out.println(winnipegClinic); System.out.println(); //Creating another vaccine clinic VaccineClinic brandonClinic = new VaccineClinic("Brandon Supersite"); System.out.println(brandonClinic); //Giving the clinic 2 doses System.out.println(" Giving Brandon 2 more doses"); brandonClinic.receiveMoreDoses(2); System.out.println(brandonClinic); //Scheduling two patients at the Brandon site System.out.println(" Scheduling Ananta amd Taylor in Brandon"); brandonClinic.schedulePatient(ananta); brandonClinic.schedulePatient(taylor); System.out.println(brandonClinic); brandonClinic.displayPatientsWaiting(); // Vaccinate the next patient in Brandon and then display the updated queue System.out.println(" Vaccinate next patient in Brandon"); brandonClinic.vaccinateNextPatient(); brandonClinic.displayPatientsWaiting(); System.out.println(brandonClinic); System.out.println(ananta); // Vaccinate the next patient in Brandon and then display the updated queue System.out.println(" Vaccinate next patient in Brandon"); brandonClinic.vaccinateNextPatient(); brandonClinic.displayPatientsWaiting(); System.out.println(brandonClinic); System.out.println(" Vaccinate next patient in Brandon. There is nobody waiting, but the code shouldn't crash"); brandonClinic.vaccinateNextPatient(); brandonClinic.displayPatientsWaiting(); // Give Winnipeg more doses System.out.println(" Give Winnipeg more doses"); winnipegClinic.receiveMoreDoses(5); System.out.println(winnipegClinic); // Administer all of the available doses in Winnipeg System.out.println(" Use all of the doses in Winnipeg"); winnipegClinic.administerAvailableDoses(); winnipegClinic.displayPatientsWaiting(); System.out.println(winnipegClinic); System.out.println(); // Schedule a new person in Winnipeg to test that they get put at the front of the list HealthID id7 = new HealthID(); Patient sarita = new Patient("Sarita", 24, id7); System.out.println(" Sarita is scheduled in position: " + winnipegClinic.schedulePatient(sarita)); winnipegClinic.displayPatientsWaiting(); System.out.println(winnipegClinic); } }

Phase 2: Vaccine Clinic Next, implement the Vaccine Clinic class, which represents the specification for a clinic that can receive and administer vaccine doses to Patients who have booked appointments. . . The Vaccine Clinic class should have: Four main instance variables: the name of the clinic (a String), the number of doses available (an int), the total number of doses administered (an int), and an array of Patients awaiting vaccines. Use a simple partially- filled array for this list of patients. Use a class constant to determine the size of your array, set to 100 for testing purposes. You may assume that the list will never become full no error checking is needed. A constructor that accepts only one parameter, the clinic's name (a String). A constructor that accepts the clinic's name (a String) and an initial supply of doses (an int). A void method receiveMoreDoses(int) that is called when the clinic receives more doses of the vaccine. An accessor method getDoses Administered() that returns the number of doses administered by the clinic. An accessor method getNumDosesAvailable() that returns the number of doses still available at the clinic. A method schedulePatient(Patient) that adds the patient to the list of patients waiting to be vaccinated by the clinic. The patient should only be added to the list if: a) the clinic has enough supply to vaccinate the patient as well as all patients currently waiting and b) the patient has not already received the vaccine. For the purpose of this assignment, patients who receive one dose are considered fully vaccinated. The method should return an int representing the patient's place in the queue or the value of an UNABLE_TO_SCHEDULE class constant if the patient was not added to the list. Make sure that the UNABLE TO SCHEDULE value does not correspond to a potential position in the queue. A method display displayPatientsWaiting() which displays the list of waiting patients to the screen (see the output example below). A method vaccinateNextPatient() that vaccinates the next patient in the list of patient awaiting vaccines. The class should implement a first-come-first-served policy when vaccinating patients from the list. As mentioned above, a patient is considered fully vaccinated after receiving one dose. . A method vaccinateNextPatient() that vaccinates the next patient in the list of patient awal The class should implement a first-come-first-served policy when vaccinating patients from the list. As mentioned above, a patient is considered fully vaccinated after receiving one dose. A method administerAvailableDoses() that vaccinates as many patients as possible by going through all of the clinic's available doses, in a first-come-first-served order. An equals method. Two clinics are considered equal if they have the same name. AtoString() method that returns a String containing the clinic's name, the doses administered, the doses available and the number of Patients still waiting to be vaccinated (formatted as shown in the sample output below) . . You can test your class with TestPhase2.java. You should get the output shown below. Winnipeg Supersite: Administered(0) Supply(3) Booked (0) Patients waiting for vaccines at Winnipeg Supersite: Scheduling alice, liqun, bob at the Winnipeg clinic Alice is in position: 1 Liqun is in position: 2 Bob is in position: 3 Winnipeg Supersite: Administered(0) Supply(3)I booked (3) Patients waiting for vaccines at Winnipeg Supersite: Alice(68), 1000:100000000, Vaccinated: false Liqun(25), 1002: 100000003, Vaccinated: false Bob(70), 1000:100000001, Vaccinated: false Trying to schedule Ananta at the Winnipeg clinic Ananta is position: -1 Winnipeg Supersite: Administered(0) Supply(3) Booked (3) Brandon Supersite: Administered (0) Supply(0) Booked (0) Giving Brandon 2 more doses Brandon Supersite: Administered(0) Supply(2) Booked (0) Scheduling Ananta amd Taylor in Brandon Brandon Supersite: Administered(0) Supply(2) Booked(2) Patients waiting for vaccines at Brandon Supersite: Ananta (35), 1003: 100000004, Vaccinated: false Taylor (30), 1003: 100000005, Vaccinated: false Vaccinate next patient in Brandon Patients waiting for vaccines at Brandon Supersite: Taylor (30), 1003: 100000005, Vaccinated: false Brandon Supersite: Administered(1) Supply(1) Booked(1) Ananta (35), 1003: 100000004, Vaccinated: true Vaccinate next patient in Brandon Patients waiting for vaccines at Brandon Supersite: Brandon Supersite: Administered(2) Supply(@) Booked (0) Vaccinate next patient in Brandon. There is nobody waiting, but the code shouldn't crash Patients waiting for vaccines at Brandon Supersite: Give Winnipeg more doses Winnipeg Supersite: Administered(0) Supply(8) Booked (3) Use all of the doses in Winnipeg Patients waiting for vaccines at Winnipeg Supersite: Winnipeg Supersite: Administered(3) Supply(5) Booked (0) Sarita is scheduled in position: 1 Patients waiting for vaccines at Winnipeg Supersite: Sarita (24), 1004: 100000006, Vaccinated:false Winnipeg Supersite: Administered(3) Supply(5) Booked(1)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!