Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is not to be done using stdio.h library and should use iostream, I need help understanding how the classes work for C + +
This is not to be done using stdio.h library and should use iostream, I need help understanding how the classes work for C specifically. I understand enough about the syntax of C but have been having issues with the constructor class objects on the C side. Thanks!
Write a complete program utilizing the class Patient The Patient class is used to track
patient information in a healthcare environment. See the table below for details on each
member of the class and its description.
Patient Class
Private members Description
string mname Stores the patients name
int mage Integer to store patients age in years
double mweight double to store patients weight in kilograms
bool madmitted Boolean variable to store whether or not patient is
currently admitted into hospital truefalse
int mlocation integer to store patient room number. If patient is not
admitted then room number should be
Public members Description
Patient Default constructor for patient class. The constructor
should initialize the patients location to and the
madmitted variable to false
Patientstring name, int age Constructor to allow name and age to be initialized
during object creation. The constructor should
initialize the patients location to and the
madmitted variable to false
setWeightdouble weight A member function to allow assignment of patients
weight in kilograms
printInfo A member function that displays all information about
patient. An example is shown below. You do not need
to worry about number of decimal points shown.
admitPatientint location A member function to admit a patient into the
hospital. The function should accept the room number
location as an input parameter, then pass this into
the internal object data and the function should also
change the madmitted variable to true
releasePatient A member function to release a patient from the
hospital. The function should change the patient
location to and should change the madmitted
variable to false
An example format for the printInfo function is:
Patient Info:
Name: Billy Bronco
Age:
Weight: kg
Admitted?: Yes
Room #:
Patient Info:
Name: John Doe
Age:
Weight: kg
Admitted?: No
Room #: NA
Note that the printInfo function will need to check the madmitted variable for truefalse
and then print YesNo based on that. Also, if the patient mlocation is the function will
print NA instead of
Inside of main you will need to create two Patient objects and demonstrate the
functionality of the class. Please create two Patient objects and use the constructor to
initialize the name and age of each of the two patients. Use the setWeight function
assign a body weight to each patient in kilograms Now, print the information for each
patient. Finally, use the admitPatient function to admit one of your two patients and you
can make up any room number you like. Print the info for that patient to show that the
admitPatient function has worked correctly. Now, use the releasePatient function and
then print the info again to show that the data inside the object has changed appropriately.
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