Question: Kuantan Hospital has assigned you as a programmer to develop a new system for them. The new system will assign patient to doctor according to

 Kuantan Hospital has assigned you as a programmer to develop a

new system for them. The new system will assign patient to doctor

according to their expertise. The proposed system will have a Person as

the main class. For assigning doctor to patient, a class is needed.

Kuantan Hospital has assigned you as a programmer to develop a new system for them. The new

system will assign patient to doctor according to their expertise. The proposed system will have a

Person as the main class. For assigning doctor to patient, a class is needed. The UML diagram in

Figure 1 shows the relationship between all classes involved in the proposed system. The proposed

system be able to display all the information key-in by the user. To develop the proposed system,

you need a part of the main class and a class named Disease in Figure 2 and Figure 3 respectively.

The output of the system is given in Figure 4 to Figure 6. Therefore, develop a complete java

program based on the given situation.

Person name: String age: int gender: String + getName(): String setName(name); void + getAge(); int setAge(age): void + getGender(): String + setGenderigender): void 4 Doctor - patient: Patient - expertise: String + Doctorname gender age) + getExpertise(); String + setExpertise expertise): void + addPatient patient):void print(); void Patient - disease: String + Patient (name, gender, age) + getDisease(): String + setDisease (disease): void + print(): vold Kuantanhospital + main(): vold Patientdoctor -patient: Patient -doctor: Doctor + addPatient patient); void + addDoctor(doctor): vold + assignPatientToDoctor): void showPatientDoctor): void + assing(disease, expertise) Disease static final CANCER:void + static final DIABETES: void static final HEART:void Figure 1 : import java.util.Scanner; public class HospitalApp public static void main(String[] args) { String name=""; int age=0; String gender=""; Assigement hospital=new Assigement(); while(true) { System.out.println(" WELCOME TO KUANTAN HOSPITAL DOCOTR-PATIENT SYSTEM" + " 4MENU : " + " 1 Add Patient " + " 2 Add Doctor + " 3 Assign Doctor to patients" + " 4 Show Doctor and Their Patients" + " Your choice : "); int choice getScanner() .nextInt(); switch (choice) { case 1: System.out.println("Your choice is "+choice); System.out.println("Add Patient Info "); Scanner s=getScanner(); System.out.println("Name : "); name=s.next(); System.out.println("Age : "); age=s.nextInt(); System.out.println("Gender : "); gender=s.next(); Patient patient=new Patient (name, age, gender); System.out.println("Disease : 1) Cancer, 2) Diabetes, 3) Heart Attack "); String disease=""; int pointl=s.nextInt (); if (point1==1) { disease=Constants.CANCER; }else if (pointi ==2) { disease=Constants.DIABETES; Jelse if (point1 ==3){ disease=Constants.HEART; } patient.setDisease (disease); patient.print(); hospital.addPatient (patient); break; Figure 2 (continue) 4 public class Constants { public static final String CANCER="cancer"; public static final String DIABETES="diabetes"; public static final String HEART="heart attack"; Figure 3 WELCOME TO KUANTAN HOSPITAL DOCTOR-PATIENT SYSTEM Menu: 1 Add Patient 2 Add Doctor 3 Assign Doctor to patients 4 Show Doctor and Their Patients Enter your choice : 1 Please add Patient info Name : Jason Age: 25 Gender: M Disease : 1) Cancer, 2) Diabetes, 3) Heart Attack Disease choice : 2 Data that you stored Name : Jason Age : 25 Gender :M Disease : Diabetes Figure 4 WELCOME TO KUANTAN HOSPITAL DOCTOR-PATIENT SYSTEM Menu : 1 Add Patient 2 Add Doctor 3 Assign Doctor to Patients 4 Show Doctor and Their Patients Enter your choice : 2 Please add Doctor info Name : Hana Age: 23 Gender: F Expertise : 1) Cancer, 2) Diabetes, 3) Heart Attack Disease choice : 2 Data that you stored Name : Hana Age : 23 Gender : Expertise : Diabetes Figure 5 WELCOME TO KUANTAN HOSPITAL DOCTOR-PATIENT SYSTEM Menu : 1 Add Patient 2 Add Doctor 3 Assign Doctor to Patients 4 Show Doctor and Their Patients Enter your choice : 4 Doctor info Name : Hana Patient info 1. Name : Jason 2. Name : Patrica Figure 6

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!