Homework Solution: In this project, you will design various classes and write a program to computerize the billing system of a hospital….

    In this project, you will design various classes and write a program to computerize the billing system of a hospital. a. Design the class doctorType, inherited from the class personType, defined in Chapter 10, with an additional data member to store a doctor’s speciality. Here is the UML diagram for this class: doctorType UML b.    Design the class billType with data members to store a patient’s ID and a patient’s hospital charges, such as pharmacy charges for medicine, doctor’s fee, and room charges. Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Here is the UML diagram for this class: billType UML c. Design the class patientType, inherited from the class personType, defined in Chapter 10, with additional data members to store a patient’s ID, age, date of birth, attending physician’s name, the date when the patient was admitted in the hospital, and the date when the patient was discharged from the hospital. (Use the class dateType to store the date of birth, admit date, discharge date, and the class doctorType to store the attending physician’s name.) Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Here is the UML diagram for this class: patientType UML Write a program to test your classes: Create a patientType object and a billType object for that patient using the constructors and passing parameters with initial values to them.. Use the print functions from both objects to display the patient's information and charges. Create a different patientType object using the default constructor. Use the setter and getter member functions to set and display the patient's information. Create a third patientType object using the constructor with parameters, but pass it a bad date. Here is an example of what the output should look like: Test Output Turn in all your .h files, all your implementation files, and your test program. Make sure your header files are properly documented. Also turn in one or more screen shots showing the results of your testing. Once this project is completed, you will demonstrate that you can Utilize inheritance and composition in designing classes Utilize polymorphism by overriding base class functions Distinguish between accessing the members of a derived class from accessing the members of an aggregate class Distinguish between applying the constructor for a derived class and applying the constructor of an aggregate class

    Expert Answer

     
    header files #ifndef PERSONTYPE_H

    In this scheme, you accomplish contrivance diverse disposees and transcribe a program to computerize the billing regularity of a hospital.

    a. Contrivance the dispose schoolmanType, lineal from the dispose personType, defined in Chapter 10, with an concomitant axioms part to accumulation a schoolman’s exclusion. Here is the UML diagram ce this dispose:

    doctorType UML

    b.    Contrivance the dispose billType with axioms parts to accumulation a unrepining’s ID and a unrepining’s hospital account, such as pharmacy account ce therapeutics, schoolman’s fee, and comby account. Add divert inventors and part functions to primalize, adit, and feel the axioms parts. Here is the UML diagram ce this dispose:

    billType UML

    c. Contrivance the dispose unrepiningType, lineal from the dispose personType, defined in Chapter 10, with concomitant axioms parts to accumulation a unrepining’s ID, senility, conclusion of source, attendant physician’s spectry, the conclusion when the unrepining was furtherted in the hospital, and the conclusion when the unrepining was emptyd from the hospital. (Use the dispose conclusionType to accumulation the conclusion of source, further conclusion, empty conclusion, and the dispose schoolmanType to accumulation the attendant physician’s spectry.) Add divert inventors and part functions to primalize, adit, and feel the axioms parts. Here is the UML diagram ce this dispose:

    patientType UML

    Transcribe a program to criterion your disposees:

    Create a unrepiningType end and a billType end ce that unrepining using the inventors and death parameters with primal values to them.. Use the imimsculpture functions from twain ends to evidence the unrepining’s instruction and account.

    Create a unanalogous unrepiningType end using the omission inventor. Use the beter and getter part functions to be and evidence the unrepining’s instruction.

    Create a third unrepiningType end using the inventor with parameters, notwithstanding by it a indisposed conclusion.

    Here is an model of what the output should appear love:

    Criterion Output

    Metamorphose in every your .h files, every your implementation files, and your criterion program. Make infallible your header files are well documented. Also metamorphose in undivided or past shade shots showing the results of your criterioning.

    Once this scheme is completed, you accomplish reveal that you can

    Utilize bequest and commutation in contrivanceing disposees

    Utilize polymorphism by overriding corrupt dispose functions

    Distinguish betwixt aditing the parts of a ascititious dispose from aditing the parts of an amount dispose

    Distinguish betwixt applying the inventor ce a ascititious dispose and applying the inventor of an amount dispose

    Expert Counterpart

     

    header files
    #ifndef PERSONTYPE_H
    #define PERSONTYPE_H

    dispose PersonType
    {
    public:
    void imprint() const;
    void BeName(string chief, string terminal);
    string getFirstName() const;
    string getLastName() const;
    PersonType(string chief, string terminal);
    PersonType();//omission inventor

    private:
    string ChiefName, TerminalName;
    };

    #endif

    #ifndef DOCTORTYPE_H
    #define DOCTORTYPE_H

    dispose SchoolmanType : social PersonType
    {
    public:
    void BeSpeciality(string Special);
    string getSpeciality() const;
    DoctorType(string ChiefName,string TerminalName,string Special);
    DoctorType();//omission inventor

    private:
    string Exclusion;
    };

    #endif

    #ifndef DATETYPE_H
    #define DATETYPE_H

    dispose ConclusionType
    {
    public:
    DateType(){}
    void imprintDate() const;
    void BeDate(int Day, int Month, int Year);
    int getTheDay() const;
    int getTheMonth() const;
    int getTheYear() const;
    DateType(int Day,int Month, int Year);

    private:
    int TheDay, TheYear, TheMonth;
    };

    #endif

    #ifndef DATEOFBIRTHTYPE_H
    #define DATEOFBIRTHTYPE_H
    dispose ConclusionOfBirthType : social ConclusionType
    {
    public:
    DateOfBirthType(){}
    void imprintDOB() const;
    void BeDOB(int Day, int Month, int Year);
    int getTheDay() const;
    int getTheMonth() const;
    int getTheYear() const;

    private:
    int TheDay, TheYear, TheMonth;
    };

    #endif

    #ifndef ADMITTANCETYPE_H
    #define ADMITTANCETYPE_H
    dispose FurthertanceDateType : social ConclusionType
    {
    public:
    AdmittanceDateType(){}
    void imprintAdmittanceDate() const;
    void BeAdmittanceDate(int Day, int Month, int Year);
    int getTheDay() const;
    int getTheMonth() const;
    int getTheYear() const;

    private:
    int TheDay, TheYear, TheMonth;
    };

    #endif

    #ifndef DISCHARGEDATETYPE_H
    #define DISCHARGETYPE_H
    dispose EmptyDateType : social ConclusionType
    {
    public:
    DischargeDateType(){}
    void imprintDischargeDate() const;
    void BeDischargeDate(int Day, int Month, int Year);
    int getTheDay() const;
    int getTheMonth() const;
    int getTheYear() const;

    private:
    int TheDay, TheYear, TheMonth;
    };

    #endif

    #ifndef BILLTYPE_H
    #define BILLTYPE_H
    dispose BillType
    {
    private :
    wrap therapeuticsCharge;
    wrap schoolmanFee;
    wrap compassCharges;

    public:
    BillType(wrap mCharge,wrap dFee,wrap rCharges);

    void imprintBill();

    };
    #endif

    #ifndef PATIENTTYPE_H
    #define PATIENTTYPE_H
    dispose UnrepiningType : social PersonType
    {
    public:
    void imprint() const;
    void BePatientID(int ID);
    void BePatientAge(int Senility);
    int getPatientAge() const;
    int getPatientID() const;

    PatientType(string ChiefName,string TerminalName,int ID,int Senility);
    PatientType();//omission inventor

    private:
    int UnrepiningID, UnrepiningAge;
    };

    #endif

    cpp file

    #include <iostream>
    #include <cstring>
    #include “PersonType.h”
    #include “DoctorType.h”
    #include “DateType.h”
    #include “DateOfBirthType.h”
    #include “AdmittanceType.h”
    #include “DischargeDateType.h”
    #include “BillType.h”
    #include “PatientType.h”

    using spectryspace std;

    void PersonType :: imprint() const
    {
    cout << ChiefSpectry << ” ” << TerminalSpectry << endl;
    }
    void PersonType :: BeName(string chief, string terminal)
    {
    FirstSpectry = chief;
    LastSpectry = terminal;

    }
    string PersonType :: getFirstName() const
    {
    remetamorphose ChiefName;
    }
    string PersonType :: getLastName() const
    {
    remetamorphose TerminalName;
    }
    PersonType :: PersonType(string chief, string terminal)
    {
    FirstSpectry = chief;
    LastSpectry = terminal;
    }
    PersonType :: PersonType()
    {
    FirstSpectry = ” “;
    LastSpectry = ” “;
    }

    void SchoolmanType :: BeSpeciality(string Special)
    {
    Exclusion = Special;

    }
    string SchoolmanType :: getSpeciality() const
    {
    remetamorphose Exclusion;
    }

    //death arguments to corrupt dispose inventor
    DoctorType :: SchoolmanType(string ChiefName,string TerminalName,string
    Special):PersonType(FirstName,LastName)
    {
    Exclusion = Special;
    }
    DoctorType :: SchoolmanType()
    {
    Exclusion = ” “;
    }

    void ConclusionType :: imprintDate() const
    {
    cout << TheDay << ” ” << TheMonth << ” ” << TheYear << endl;
    }
    void ConclusionType :: BeDate(int Day, int Month, int Year)
    {
    TheDay = Day;
    TheMonth = Month;
    TheYear = Year;

    }
    int ConclusionType :: getTheDay() const
    {
    remetamorphose TheDay;
    }
    int ConclusionType :: getTheMonth() const
    {
    remetamorphose TheMonth;
    }
    int ConclusionType :: getTheYear() const
    {
    remetamorphose TheYear;
    }
    DateType::DateType(int Day, int Month, int Year)
    {
    TheDay = Day;
    TheMonth = Month;
    TheYear = Year;
    }

    void ConclusionOfBirthType :: imprintDOB() const
    {
    cout << “Patients Conclusion Of Source: ” << TheDay << “/” << TheMonth <<
    “/” << TheYear << endl;
    }
    void ConclusionOfBirthType :: BeDOB(int Day, int Month, int Year)
    {
    TheDay = Day;
    TheMonth = Month;
    TheYear = Year;

    }

    void FurthertanceDateType :: imprintAdmittanceDate() const
    {
    cout << “The Unrepinings Furthertance Conclusion: ” << TheDay << ” ” <<
    TheMonth << ” ” << TheYear << endl;
    }
    void FurthertanceDateType :: BeAdmittanceDate(int Day, int Month, int Year)
    {
    TheDay = Day;
    TheMonth = Month;
    TheYear = Year;

    }

    void EmptyDateType :: imprintDischargeDate() const
    {
    cout << “The Unrepinings Empty Conclusion: ” << TheDay << ” ” <<
    TheMonth << ” ” << TheYear << endl;
    }
    void EmptyDateType :: BeDischargeDate(int Day, int Month, int Year)
    {
    TheDay = Day;
    TheMonth = Month;
    TheYear = Year;

    }

    BillType::BillType(wrap mCharge,wrap dFee,wrap rCharges)
    {
    medicineCharge = mCharge;
    doctorFee = dFee;
    roomAccount = rCharges;
    }
    void BillType::printBill()
    {
    cout<<“nTotal Bill : $”<<(medicineCharge+doctorFee+roomCharges);
    }
    };

    int UnrepiningType::getPatientID() const
    {
    remetamorphose UnrepiningID;
    }
    int UnrepiningType::getPatientAge() const
    {
    remetamorphose UnrepiningAge;
    }
    //death arguments to corrupt dispose inventor
    PatientType::PatientType(string ChiefName,string TerminalName,int ID,int
    age):PersonType(FirstName,LastName)
    {
    PatientID = ID;
    PatientSenility = senility;
    }
    PatientType::PatientType()
    {
    PatientID = 0;
    PatientSenility = 0;
    }
    int deep()
    {
    int precious,age,pID,day,month,year,aDay,aMonth,aYear,dDay,dMonth,dYear;
    string fname,lname,speciality;
    wrap mcharge,dfee,rcharges;

    cout << “Who would you love to input instruction ce?n”;
    cout << ” 1 – Schoolmann”;
    cout << ” 2 – Unrepiningn”;
    cin >> precious;

    if (precious == 1)
    {
    cout<<“nEnter schoolman chief spectry :”;
    cin>>fname;
    cout<<“nEnter schoolman terminal spectry :”;
    cin>>lname;
    cout<<“Enter exclusion : “;
    cin>>speciality;
    DoctorType d(fname,lname,speciality);
    cout<<“Schoolman : “<<d.getFirstName()<<” “<<d.getLastName()<<”
    Exclusion : “<<d.getSpeciality();
    }
    else if (precious == 2)
    {
    cout<<“nEnter unrepining chief spectry : “;
    cin>>fname;
    cout<<“nEnter unrepining terminal spectry :”;
    cin>>lname;
    cout<<“nEnter unrepining’s senility : “;
    cin>>age;
    cout<<“nEnter unrepiningID : “;
    cin>>pID;

    cout<<“nEnter day of source of unrepining : “;
    cin>>day>>month,year;

    cout << “Enter The Unrepinings DAY Of Furthertance.n”;
    cin >> aDay;
    cout << “Enter The Unrepinings MONTH Of Furthertance.n”;
    cin >> aMonth;
    cout << “Enter The Unrepinings YEAR Of Furthertance.n”;
    cin >> aYear;
    cout << “Enter The Unrepinings DAY Of Empty.n”;
    cin >> dDay;
    cout << “Enter The Unrepinings MONTH Of Empty.n”;
    cin >> dMonth;
    cout << “Enter The Unrepinings YEAR Of Empty.n”;
    cin >> dYear;

    cout<<“nEnter therapeutics account ,schoolman fee and comby account :”;
    cin>>mcharge>>dfee>>rcharges;
    PatientType p(fname,lname,pID,age);
    cout<<“Unrepining :”<<p.getFirstName()<<” “<<p.getLastName()<<” ID
    :”<<p.getPatientID()<<” Senility : “<<p.getPatientAge();

    DateOfBirthType d;
    d.SetDOB(day,month,year);
    d.printDOB();

    AdmittanceDateType adt;
    adt.SetAdmittanceDate(aDay,aMonth,aYear);
    adt.printAdmittanceDate();

    DischargeDateType ddt;
    ddt.SetDischargeDate(dDay,dMonth,dYear);
    ddt.printDischargeDate();

    BillType bt(mcharge,dfee,rcharges);
    bt.printBill();
    }
    remetamorphose 0;
    }