Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is the class PersonType below just do Ques2 in C++ class PersonType{ public

ID: 3920997 • Letter: H

Question

Here is the class PersonType below just do Ques2 in C++

class PersonType{
public:
   void print() const;
   void setName(string first, string last);
   string getFirstName() const;
   string getLastName() const;
   PersonType(string first = "", string last = "");

private:
   string firstName;
   string lastName;


};

Question: a. Write a class doctorType. inherited from the class personType, defined in chapter 12, with an additional data member to store a doctor's speciality. Add appropriate constructors and member functions to initialize, access and manipulate the data members b. Write a class patientType, inherited from the class personType, defined in chapter 12, with additional data members to store a patient's ID, age, and DOB. 2. Design a class billType, with data members to store a patient's information, the patient's doctor's information, and the hospital charges. Add appropriate constructors and member functions to initialize, access and manipulate the data members Write a program to test you classes.

Explanation / Answer

lass PersonType{
public:
   void print()

{

cout<<"Name is "<<firstName<<lastName<<endl;

}
   void setName(string first, string last)

{

strcpy(firstName,first);

strcpy(lastName,last);

}
   string getFirstName()

{

return firstName;

}
   string getLastName()

{

return lastName;

}
   PersonType(string first = "", string last = "");

private:
   string firstName;
   string lastName;


};

class DocType:public PersonType

{
public:
   void printSpec()

{

cout<<"Doctor specialization is"<<docSpec;

}
   void setspec(string sp)

{

strcpy(docSpec,so);

}
private:

   string docSpec;


};

class PatientType:public PersonType

{

public:
   void printPatientInfo()

{

cout<<" Patient I'd is"<<pid<<endl;

cout<<"Age is "<<age<<endl<<" Date of birth is "<<dob;

}
   void setPatientInfo(string pd,int ag,string db)

{

strcpy(pid,pd);

age=ag;

strcpy(dob,db);

}

private:
   string pid;

int age;

   string dob;


};

class billType:public DocType,public PatientType

{

float bill;

public:

void setBill(float bl)

{

Bill=bl;

}

void printBill()

{

cout<< " Bill is "<<bill<<endl;

}

};

void main()

{

BillType b1.setName(" Mathew","John");

b1.setPatientInfo("BO11", 50,"12-12-2015");

b1.print();

b1.printPatientInfo();

b1.setspec("Cardio");

b1.printSpec();

b1.setBill(40000.00);

b1.printBill();

}