Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Write the program in C++, Lab10.cpp is given Lab10.cpp: #include #include using namespace std; // Base class personType class personType { public: void print()const; //Function

Write the program in C++,
Lab10.cpp is given
image text in transcribed
Lab10.cpp:
#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
}
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(doctor1, patient1);
b1.setCharge(250.66);
cout Printing... ";
person1.print();
cout
cout Printing... ";
doctor1.print();
cout
cout Printing... ";
patient1.print();
cout
cout Printing... ";
b1.print();
cout
return 0;
}
Question2 (Composition) .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 &d patient Type &p);I/ Constructor void setCharge(double):/Set hospital charges double getCharge const://Get hospital charges void printOconst,l/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 Submit a single cpp file. Output CAW persontype> Printing... erson FirstName-Lisa LastName-Regan doctorType> Printing... octor FirstName-Sarah LastName-Conner Specialty-Dentist patientType> Printing... atient FirstName-Sam LastName-Fire Id-200 Age-100 D08-1916 billType> Printing... atient FirstName-Sam LastName-Fire Id-200 Age-100 DOB-1916 atient's doctor FirstName-Sarah LastName-Conner Specialty-Dentist ospital chrge-250.66 press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students explore these related Databases questions