Question
###################################################################### # PYTHON 2 # date: # desc: #################################################################### # A patient class. A patient has a name, age and weight. Only the name #
###################################################################### # PYTHON 2
# date: # desc: ####################################################################
# A patient class. A patient has a name, age and weight. Only the name # and age are provided as arguments for the constructor. On top of # accessors and mutators for those variables, the patient class also has # an increaseAge function that increases the age by 1.
# An In class which is a subclass of the Patient class and refers to an # in-patient. An in-patient also contains a "stay" instance variable # that stores the number of days that that patient will stay in the # hospital. Its constructor receives the name, age and stay duration as # arguments. On top of appropriate accessors and mutators, the In class # also has a __str__ function to define how an In object would be printed.
# An Out class, which is a subclass of the Patient class and refers to # an out-patient. An outpatient receives the name and age as arguments # to its constructor. It also has a __str__ function that defines how an # Out object would be printed.
# An ICU class which is a subclass of the In class and refers to a # patient in the ICU. The ICU class receives the name and age as # arguments to its constructor. It also has a class variable called days # with the value 5 stored in it. This class variable is used to # determine what the stay of the patient will be.
# A CheckUp class which is a subclass of the Out class and refers to a # patient who is getting a checkup at the hospital. It receives the name # and age as arguments for its constructor.
The Patient class has a name, age, and a weight.
2. The name and age of the patient are provided as arguments to the constructor
3. The weight of all Patient objects is set to 150 by default.
4. The class should have accessors and mutators for all the instance variables which use the decorator method discussed in class. Additionally: The weight mutator should only allow for the weight to be set to values between 0 and 1400 inclusive i.e. [0, 1400]. The age mutator should not allow for the age to be set to negative values. If this is attempted, the age is set to 0 instead of the negative value.
5. The class should also have an increaseAge function that increases the age by 1.
Some additional/new specification include 1. An In class that inherits from the Patient class. This class refers to an In-patient in a hospital (i.e. one who will be staying in the hospital for a few days). It has a stay instance variable to denote how many days that patient will be staying in the hospital. Has a constructor that receives the name, age and stay as arguments Contains appropriate an accessor and mutator for the stay variable. The mutator only allows for the stay to be set to values above 0 i.e. (0, ) Contains a __str__ function that prints out IN- followed by the name, age, weight, and stay in that order.
2. An Out class that also inherits from the Patient class. This class refers to an out-patient in a hospital (i.e. one who will not be staying in the hospital). It has: A constructor that receives name and age as arguments a __str__ function that prints out OUT- followed by the name, age, and weight in that order.
3. An ICU class that inherits from the In class. This class refers to in-patients that are in the ICU wing of the hospital. It has: A constructor that receives name and age as arguments A class variable1 called days with the value 5 in it that is used to update the stay of the patient.
4. A CheckUp class that inherits from the Out class. This class refers to out-patients who are just in the hospital for a check up. It Receives the name and age as arguments for its constructor.
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