Question: using java Complete TODO 1 in the class Patient, and TODOs 2 and 3 in the class HospitalmanagementSystem. - Assume that all getters and setters
using java Complete TODO in the class Patient, and TODOs and in the class HospitalmanagementSystem.
Assume that all getters and setters are appropriately coded for all private attributes of all classes.
The static method Math.Random returns a double value with a positive sign, greater than or equal to and less than
You can add methodsattributes as you see fit.
The output of running the main method is provided after the code.
Doctor.java
import java.util.ArrayList;
public class Doctor
private String name;
private int id;
private double salary;
a list of patients the doctor currently assigned to
ArrayList patientsnew ArrayList;
public void addPatientPatient p
patients.addp;
public DoctorString name, int idint salary
super;
this.name name;
this.id id;
this.salarysalary;
Patient.java
import java.util.ArrayList;
public class Patient
private String patientName;
private String patientCode; unique identification number consisting of digits
private String address;
private int age;
private boolean highPriority; true if high priority, false if not
static ArrayList codeListnew ArrayList;
public PatientString patientName, String address, int age
this.patientName patientName;
this.patientCode generatePatientCode;
this.address address;
this.ageage;
highPriorityfalse;
TODO : Create the method to generate the patientCode, which consists
of randomly generated numbers.
The generated code should be unique for each patient.
private String generatePatientCode
HospitalManagementSystem.java
import java.util.ArrayList;
public class HospitalManagementSystem
ArrayList doctorsnew ArrayList;
ArrayList departments new ArrayList;
ArrayList patientListnew ArrayList;
public void addDoctorDoctor doc
doctors.adddoc;
TODO : write the code for the method to print the total salaries of all doctors.
public double printTotalSalaries
TODO : Write a method to return a reference to the most popular doctor. The most
popular doctor is the one who has most appointments. If two doctors have the same
number of patients, you may return a reference to any of them.
public static void mainString args
HospitalManagementSystem systemnew HospitalManagementSystem;
Patient pnew PatientMohammed"Qatar",;
Patient pnew PatientYuki"Japan",;
Patient pnew PatientNusret"Turkey",;
Patient pnew PatientMichael"USA",;
Patient pnew PatientAli"Iran",;
Patient pnew PatientRabeh"Algeria",;
Patient pnew PatientMathews"Australia",;
Patient pnew PatientRashid"Jordan",;
Doctor dnew DoctorAmal;
system.addDoctord;
Assigning patients to d
daddPatientp;
daddPatientp;
daddPatientp;
Doctor dnew DoctorOmar;
system.addDoctord;
Assigning patients to d
daddPatientp;
daddPatientp;
daddPatientp;
daddPatientp;
Doctor dnew DoctorEman;
system.addDoctord;
Assigning patients to d
daddPatientp;
daddPatientp;
daddPatientp;
daddPatientp;
daddPatientp;
printing total salaries of the doctors
system.printTotalSalaries;
Printing the name of the most popular doctor.
System.out.printThe Most popular Doctor is: ;
Doctor mostpopular system.mostPopularDoctor;
System.out.printlnmostpopulargetName;
The output of main is as follows:
Total salaries are
The Most popular Doctor is: Eman
Consider the following hospital management system consists of classes; Doctor, Patient, and
HospitalManagementSystem as illustrated in the class diagram below:
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
