Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Question - 04
- #include <bits/stdc++.h>
- using namespace std;
- // ---( a )---
- class person {
- private:
- string firstName;
- string lastName;
- public:
- person( string s1, string s2 ) {
- firstName = s1;
- lastName = s2;
- }
- void print() {
- // what to print?
- std::cout << firstName << ' ' << lastName << endl;
- }
- void setName( string s1, string s2 ) {
- firstName = s1;
- lastName = s2;
- }
- string getFirstName() {
- return firstName;
- }
- string gerLastName() {
- return lastName;
- }
- };
- // ---( b )---
- class doctor : public person {
- private:
- string doctorsSpeciality;
- public:
- doctor( string s1, string s2, string s3 ) : person( s1, s2 ) {
- doctorsSpeciality = s3;
- }
- void setDoctorsSpeciality( string s ) {
- doctorsSpeciality = s;
- }
- void getDoctorsSpeciality() {
- return doctorsSpeciality;
- }
- };
- // ---( c )---
- class bill {
- private:
- int patientId;
- int pharmacyCharges;
- int doctorsFee;
- int roomCharges;
- public:
- bill( int id, int phc, int df, int rc ) {
- patientId = id;
- pharmacyCharges = phc;
- doctorsFee = df;
- roomCharges = rc;
- }
- void setPatientId( int id ) {
- patientId = id;
- }
- void setPharmacyCharges( int charge ) {
- pharmacyCharges = charge;
- }
- void setDoctorsFee( int fee ) {
- doctorsFee = fee;
- }
- void setRoomCharges( int charge ) {
- roomCharges = charge;
- }
- int getPatientId() {
- return patientId;
- }
- int getPharmacyCharges() {
- return pharmacyCharges;
- }
- int getDoctorsFee() {
- return doctorsFee;
- }
- int getRoomCharges() {
- return roomCharges;
- }
- };
- // ---( d )---
- class patient : public person {
- private:
- int patientId;
- int age;
- public:
- class date {
- int day;
- int month;
- int year;
- dateOfBirth( int dd, int mm, int yyyy ) {
- day = dd;
- month = mm;
- year = yyyy;
- }
- void setDay( int d ) {
- day = d;
- }
- void setMonth( int m ) {
- month = m;
- }
- void setYear( int y ) {
- year = y;
- }
- int getDay() {
- return day;
- }
- int getMonth() {
- return month;
- }
- int getYear() {
- return year;
- }
- };
- class doctor {
- string physiciansName;
- doctor( stirng s ) {
- physiciansName = s;
- }
- void setPhysiciansName( string s ) {
- physiciansName = s;
- }
- string getPhysiciansName() {
- return physiciansName;
- }
- };
- private:
- doctor doc;
- date dateOfBirth;
- date admitDate;
- date dischargeDate;
- public:
- patient( string s1, string s2, int id, int a ) : person( s1, s2 ) {
- patientId = id;
- age = a;
- }
- int getPatientId () {
- return patientId;
- }
- int getAge() {
- return age;
- }
- string getPhysiciansName() {
- return doc.getPhysiciansName();
- }
- string getDateOfBirth() {
- string dob = to_string( dateOfBirth.getDay() ) + "-" + to_string( dateOfBirth.getMonth() ) + "-" + to_string( dateOfBirth.getYear() );
- return dob;
- }
- string getAdmitDate() {
- string ad = to_string( admitDate.getDay() ) + "-" + to_string( admitDate.getMonth() ) + "-" + to_string( admitDate.getYear() );
- return ad;
- }
- string getDischargeDate() {
- string dd = to_string( dischargeDate.getDay() ) + "-" + to_string( dischargeDate.getMonth() ) + "-" + to_string( dischargeDate.getYear() );
- return dd;
- }
- void setPhysiciansName( stirng s ) {
- doc = new doctor( s );
- }
- void setDateOfBirth ( int d, int m, int y ) {
- dateOfBirth = new date( d, m, y );
- }
- void setAdmitDate ( int d, int m, int y ) {
- admitDate = new date( d, m, y );
- }
- void setDischargeDate ( int d, int m, int y ) {
- dischargeDate = new date( d, m, y );
- }
- };
Add Comment
Please, Sign In to add comment