Assigement
Assigement
Id , name , address and contact no are common attribute in the Patient and Doctor
i.e
private in id;
Q3
In CheckUp Class there are has relation (composition) with Patient Class (patient Object or patient detail
),
With Doctor Class (Doctor Object or doctor detail ) and with Clinical Test Class (Object or detail of clinical
test)
And then we can use Composition concept by adding Address instance Object in Patient Class and
Doctor Class.
Q 4 in Q 2 we create super class for Patient and doctor and below is code of both classes
Hence doctor and patient extend Person therefore all instance and methods will available for both
classes
Doctor Class
Patient Class
}
Q 5 if the system two more types of Patient (InPatient,OutPatient) then we can apply inheritance
concept on Patient
Store all common info of Paitent in SupperClass and then InPatient and outpatient will extends them
// Common info
// Common info
Private bedNo
// etc
Q6
Q7
This.doctor = doc;
This.dateAndTime = checkupDate;
This.clinicalTest = clinicalTest;
@Override
“ ID ”+ patient.getId()+
“ Address”+ patient.getAddress()+
“Age”+ patient.getAge()+
“ Address ”+doctore.getAddress()+
“ contact no ”+doctore.getContactNo()+
“ Specialization ”+doctore.getSpecialization()+
Return detail;
}
}
Q8
Checkup.toString();