Question: C++ Please read the intructions below carefully before you answer the question! Output example is given at the end and should match!! Download Lab10.cpp (given

C++

Please read the intructions below carefully before you answer the question! Output example is given at the end and should match!!

Download Lab10.cpp (given below). In this file, the definition of the class personType has given. Think of the personType as the base class.

Lab10.cpp is provided below:

#include #include using namespace std; // Base class personType class personType { public: void print()const; //Function to output the first name and last name //in the form firstName lastName. void setName(string first, string last); string getFirstName()const; string getLastName()const; personType(string first = "", string last = ""); //Constructor //Sets firstName and lastName according to the parameters. //The default values of the parameters are null strings. //Postcondition: firstName = first; lastName = last private: string firstName; //variable to store the first name string lastName; //variable to store the last name };

void personType::print() const { cout << "Person FirstName="< Printing... "; person1.print(); cout << endl; cout << " Printing... "; doctor1.print(); cout << endl; cout << " Printing... "; patient1.print(); cout << endl; cout << " Printing... "; b1.print(); cout << endl; return 0; }

Question:

Derive the class doctorType, inherited from the class personType, with an additional class member variable member to store a doctors specialty(string type) Then, implement following class member function prototypes. doctorType(string,string,string);//Firstname Lastname Specialty doctorType();//Default constructor void setSpecialty(string);//Set doctor specialty string getSpecialty()const;// Get doctor specialty void print()const;//Display doctor information the same as given output format

Derive the class patientType, inherited from the class personType, with additional class member variables to store a patients id , age , and dob (Date of birth)(All are integer ). Then, implement following class member function prototypes. patientType(string, string, int, int, int);//Firstname Lastname id age dob patientType();Default constructor void setId(int);//Set patient id void setage(int);//Set patient age void setDob(int);//Set patient DOB int getId()const;//Get patient id int getage()const;//Get patient int getDob()const;//Get patient DOB void print()const; //Display patient information the same as given output format

Design a class billType, with class member variables to store a patients information (patientType ), the patients doctors information ( doctorType ), and the hospital charges( double ). Then, implement following class member function prototypes. billType(doctorType &, patientType &); // Constructor void setCharge(double);//Set hospital charges double getCharge()const;//Get hospital charges void print()const;//Display a bill information the same as given output format

Use the provided driver program to test your program. You should get the same output

Output:

Printing...

Person FirstName=Lisa LastName=Regan

Printing...

Doctor FirstName=Sarah LastName=Conner Specialty=Dentist

Printing...

Patient FirstName=Sam LastName=Fire Id=200 Age=100 DOB=1916

Printing..

Patient FirstName=Sam LastName=Fire Id=200 Age=100 DOB=1916

Patient's doctor FirstName=Sarah LastName=Conner Specialty=Dentist

Hospital charge=250.66$

Press any key to continue...

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!