Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Assignment 3: Inheritance Any hospital has different types of patients. Create an inheritance hierarchy to represent various types of patients that visit a hospital
C++
Assignment 3: Inheritance Any hospital has different types of patients. Create an inheritance hierarchy to represent various types of patients that visit a hospital (See the hierarchy below). Use the class patient as the base class of the hierarchy, then add classes out-patient and in-patient that derive from class Patient. Add one more class COIVD-patient that inherits from the in-patient class. Base class Patient should include data members that represent the national number, name and birth date of the patient (Feel free to use the Date class that we used in the class as an example and add to it) and the symptoms (each patient can have one or many symptoms). Patient constructor should initialize those data members ensure that the national number consists of 10 digits and that the birth date is a valid date. Out-patient class should inherit the Patient class functionality and also include data members that represent the name of the doctor they visited, the diagnosis and a flat fee for the amount they paid for the visit. The in-patient class should inherit Patient functionality and also include data members that represent the ward they were admitted to, the doctor monitoring them, the number of days that the patient stayed in the hospital and the diagnosis. The in-patient class should include a public member function Calculate HospitalFee that uses the following formula (daysStayed *50). The COVID-patient class inherits from the in-patient class, the ward name for this specific class of patients is always 'COVID', and the diagnosis is always 'COVID-19' This class also has data members that represent whether the patient has required supplemental oxygen, and whether they were admitted to the ICU and the number of days they spent in the ICU. This class should redefine the Calculate HospitalFee member function to have the following formula (daysStayed*(50+ (20*oxygenflag)) +ICUdaysStayed*50). (daysStayed is the number of days the patient stayed in the hospital, ICUdaysStayed is the number of days the patient stayed in ICU and oxygenflag is flag that indicates whether the patient was given suplimental oxygen treatment or not) Please make sure that your classes' public service sections have the appropriate set and get functions to retrieve the data. And have a print function that prints the patient information for each of the five patient classes. Make sure that you redefine the print function in each class to print the information inherited from base classes in addition to the current class where the print function is defined. Write the main function to enter one patient at a time (giving the option of entering a new patient or exit the program) the program should allow the user to specify the type of patient they are entering (out-patient, in-patient or covid-patient). The program should display the patient information and the hospital bill that calculates the hospital fee for patient depending on the type of the patientStep 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