In The Hospital, the patients are divided into two types. Outpatient is a patient that visits the hospital just for an appointment. Inpatient is a patient that stays in the hospital few days before a surgery is made. The manager want to make a system to keeps the information of inpatients such as surgery name, surgery date, and surgeon ,and information about Outpatient such as appointment date, clinic name, and doctor name.
- Complete the Patient class below.
- Define an Inpatient class that inherit the functionality of the class defined below.
- Define an Outpatient class that inherit the functionality of the class defined below.
-Print the inpatient and outpatient information.
-Test your program.
class patient{
private:
char *patientName;
int file_num;
string patient_diagnostic;
public:
// Define a constructure function to initilize data members.
// Define a print function to print a patient information.
// Define a get function to return the diagnostic of patient.
};********************************
هذي محاولاتي :
#include <iostream>
#include <string>
using namespace std;
class patient{
private:
char *patientName;
int file_num;
string patient_diagnostic;
public:
patient ( char *patna , int filnu ,string patdia )
{
*patientName = *patna ;
file_num = filnu;
patient_diagnostic = patdia ;
}// Define a constructure function to initilize data members.
void printpatientinformation ()
{
cout << "The information of patient :"
<< "\n patient Name:" << patientName
<< "\n file num:" << file_num
<< "\n patientdiagnostic:"<< patient_diagnostic
<<endl;
}
// Define a print function to print a patient information.
string Getpatientdiagnostic ()
{
return patient_diagnostic;}// Define a get function to return the diagnostic of patient.
};
//=======================================
class Inpatient:public patient
{
protected:
string SurgeryName ;
int SurgeryDate ;
string Surgeon ;
public :
Inpatient(string surgeryname , int surgerydate , string surgeon, char *PatientName,int filenum , string patientdiagnostic)
:patient (*PatientName , filenum , patientdiagnostic )
{
SurgeryName = surgeryname;
SurgeryDate = surgerydate;
Surgeon = surgeon ;
cout << "cons" ;
}
~ Inpatient (){cout<<"des";}
void printpatientinformation ()
{ cout << "The information of patient :"
<< patient::printpatientinformation()
<<"\n Surgery Name:"<<SurgeryName
<< "\n Surgery Date:"<< SurgeryDate
<<"\n Surgeon:"<<Surgeon
<<endl;
}
};
//========================================
class Outpatient :public patient
{
protected :
int AppointmentDate;
string ClinicName ;
string DoctorName ;
public :
Outpatient (int appointmentdate,string clinicname, string doctorname , char *PatientName,int filenum , string patientdiagnostic)
:patient (*PatientName , filenum , patientdiagnostic )
{ AppointmentDate = appointmentdate ;
ClinicName = clinicname ;
DoctorName = doctorname ;
cout << "cons" ;
}
~Outpatient () {cout<<"des";}
void printpatientinformation ()
{ cout << "The information of patient :"
<<patient::printpatientinformation()
<< "\n AppointmentDate:"<<AppointmentDate
<<"\n Clinic Name:"<<ClinicName
<<"\n Doctor Name:"<<DoctorName
<<endl;
}
};
//=======================================
int main ()
{
Inpatient obj1('loas', 1/7/2010 ,' mahamad', ) ;
Outpatient obj2;
obj1.printpatientinformation();
obj2.printpatientinformation();
return 0;
}بليز وضوحوا لي الاخطاء مع الشرح لان مخي دااار