Question
Programming Exercise 11 from C++ Programming Chapter 11 Design various classes and write a program to comperterize the billing system of a hospital. Design the
Programming Exercise 11 from C++ Programming Chapter 11 Design various classes and write a program to comperterize the billing system of a hospital. Design the class doctorType, inherited from the class personType, 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.
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.
Design the class patientType, inherited from the class personType, with additional data members to store the 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 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. Write a program to test your classes. (class personType and class dateType follow)
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;
};
void personType::print() const {
cout << firstName << " " << lastName; }
void personType::setName(string first, string last) {
firstName = first;
lastName = last; }
string personType::getFirstName() const {
return firstName; }
string personType::getLastName() const {
return lastName; }
personType::personType(string first, string last) {
firstName = first;
lastName = last; }
class dateType {
public:
void setDate(int month, int day, int year);
int getDay() const;
int getMonth() const;
int getYear() const;
void printDate() const;
dateType(int month = 1, int day = 1, int year = 1900);
private:
int dMonth;
int dDay;
int dYear;
};
void dateType::setDate(int month, int day, int year) {
dMonth = month;
dDay = day;
dYear = year; }
int dateType::getDay() const {
return dDay; }
int dateType::getMonth() const {
return dMonth; }
int dateType::getYear() const {
return dYear; }
void dateType::printDate() const {
cout << dMonth << "-" << dDay << "-" << dYear; }
dateType::dateType(int month, int day, int year) {
dMonth = month;
dDay = day;
dYear = year; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started