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

C++ Download Lab10.cpp . In this file, the definition of the class personType ha

ID: 3794869 • Letter: C

Question

C++

Download Lab10.cpp . 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 <iostream>
#include <string>
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="<<firstName << " LastName=" << lastName<< endl;
}

void personType::setName(string first, string last)
{
firstName = first;
lastName = last;
}

string personType::getFirstName() const
{
return firstName;
}

string personType::getLastName() const
{
return lastName;
}

//constructor
personType::personType(string first, string last)

{
firstName = first;
lastName = last;
}
// --------------------Start your code from here

//--------------------driver program
int main()
{

personType person1("Lisa", "Regan");
doctorType doctor1("Sarah", "Conner", "Dentist");
patientType patient1("Sam", "Fire",200,100,1916);
billType b1;
b1.setDoctor(doctor1);
b1.setPatient(patient1);
b1.setCharge(250.66);
cout << "<personType> Printing... ";
person1.print();
cout << endl;
cout << "<doctorType> Printing... ";
doctor1.print();
cout << endl;
cout << "<patientType> Printing... ";
patient1.print();
cout << endl;
cout << "<billType> 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 doctor’s 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 patient’s 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 patient’s information
( patientType ), the patient’s doctor’s 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:

<perspnType> Printing...

Person FirstName=Lisa LastName=Regan

<doctorType> Printing...

Doctor FirstName=Sarah LastName=Conner Specialty=Dentist

<patientType> Printing...

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

<billType> 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...

Explanation / Answer

#include <iostream>

#include <iomanip>

#include <string>

#include "Fields_HealthProfile.h"

using namespace std;

int main()

{

string a;

char b;

int c;

float e;

//-| Collecting Person's Name

cout << "Enter the person's First Name" << endl;

cin >> a;

set_Fname(a);

cout << "Enter the person's Last Name" << endl;

cin >> a;

set_Lname(a);

//-| Collecting Male or Female

cout << "Enter the person's Gender" << endl;

cin >> b;

set_gender(b);

//-| Collectiong Birth Information

cout << "What is the birth month (in form ex. 01) ?" << endl;

cin >> c;

set_bmonth(c);

cout << "What is the birth day (in form ex. 05) ?" << endl;

cin >> c;

set_bday(c);

cout << "What is the birth year (in form ex. 1992) ?" << endl;

cin >> c;

set_byear(c);

//-| Collecting Height and Weight

cout << "What is the Person's Height in inches?" << endl;

cin >> e;

set_height(e);

cout << "What is the Person's Weight in pounds?" << endl;

cin >> e;

set_weight(e);

//-| Calculating and Printing: Age, BMI, Max Heart Rate, and Target Heart Rate.

int age;

age = person_age();

float bodymass;

bodymass = body_mass();

int mheart;

int theart;

mheart = max_heartrate(age);

theart = targetheartrate(mheart);

cout << "The Person's Age is: " << age << " their BMI is: " << bodymass << " their Maximum Heart Rate is: " << mheart << " and their Target Heart Rate is: " << theart << '.' << endl;

return 0;

}