Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use python programming Q5 There are four parts to this question. You will need to use the patient class and the Ward class that are

use python programming

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Q5 There are four parts to this question. You will need to use the patient class and the Ward class that are defined in the template. Q5a Write a class that fulfils the following specifications. Class name BClassward There is no parameter for this class constructor. Parameter(s) argument(s) for the constructor init Detailed description This class inherits the Ward class given in the template. Class attributes Override the class attributes as followed: The maximum occupancy of a B class ward is 6. Its daily rate is 100 dollars instead of 35 dollars. Example usage ward - BClassward() print(BClassward. MAXIMUM_OCCUPANCY) print(BClassWard.DAILY_RATE) ward.check_in("Jane Doe") ward. increment_length_of_stay ward.check_in("John Doe") ward. increment_length_of_stay() for patient in ward.patients: print(patient.name) print(ward.get_patient_cost(patient.name)) Example usage 6 output 100 Jane Doe 200 John Doe 100 Q5b. Write a class that fulfils the following specifications. Class name Parameter(s) argument(s) for the constructor init AClassWard There is no parameter for this class constructor. Detailed description This class inherits the Ward class given in the template. Class attributes | 1. Override the class attributes as followed: The MAXIMUM_OCCUPANCY of an Aclassward is 1. Its DAILY_RATE IS 500 dollars instead of 35 dollars. 2. Define an additional class attribute: SLEEPER_UNIT_PRICE: float The default value for the SLEEPER_UNIT_PRICE is 100 dollars. Instance attribute | The class has an additional instance attribute: 1. has_sleeper_unit: bool The default value for this attribute is False. Example usage ward - Aclassward() print(AClassWard. MAXIMUM_OCCUPANCY) print(AClassWard.DAILY_RATE) print(ward. has_sleeper_unit) Example usage output 1 500 False Q5c. Override the instance method check in for the AclassWard class as follows. Method name check_in Parameter(s) 1. patient_name: str argument(s) 2. needs_sleep_unit: bool The second parameter, needs_sleep_unit, is an optional parameter and its default value is False. Return value This method does not have a return value Detailed Call the method of same name in the parent's class with patient_name description as the parameter. Use the parameter needs_sleep_unit to set the value of the instance attribute has_sleeper_unit. Example usage ward 2012 - AClassward() ward201a.check_in("Tom Harris", False) ward 2016 - AClassward() ward2016.check_in("Cassandra Green", True) print(ward2012.patients[0].name) print(ward201a.has_sleeper_unit) print(ward2016.patients[0].name) print(ward201b.has_sleeper_unit) Example usage Tom Harris output False Cassandra Green True Q5d. Override the instance method get_patient_cost for the Aclassward class Method name get_patient_cost 1. patient_name: str Parameter(s) argument(s) Return value 1. a float Detailed description Example usage Get the basic cost using the get_patient_cost method from the parent class with the necessary parameters. Return the sum of the basic cost and the product of the SLEEPER_UNIT_RATE and the instance's length of stay if the instance attribute has_sleeper_unit is True. Otherwise, return the basic cost. ward2012 - AClassWard() ward201a.check_in("Tom Harris", False) ward2016 - AClassWard() ward201b.check_in("Cassandra Green", True) ward2012.increment_length_of_stay ward201b.increment_length_of_stay() print(ward201a.get_patient_cost("Tom Harris")) print(ward2015.get_patient_cost("Cassandra Green")) Example usage output 500 600 Q5 There are four parts to this question. You will need to use the patient class and the Ward class that are defined in the template. Q5a Write a class that fulfils the following specifications. Class name BClassward There is no parameter for this class constructor. Parameter(s) argument(s) for the constructor init Detailed description This class inherits the Ward class given in the template. Class attributes Override the class attributes as followed: The maximum occupancy of a B class ward is 6. Its daily rate is 100 dollars instead of 35 dollars. Example usage ward - BClassward() print(BClassward. MAXIMUM_OCCUPANCY) print(BClassWard.DAILY_RATE) ward.check_in("Jane Doe") ward. increment_length_of_stay ward.check_in("John Doe") ward. increment_length_of_stay() for patient in ward.patients: print(patient.name) print(ward.get_patient_cost(patient.name)) Example usage 6 output 100 Jane Doe 200 John Doe 100 Q5b. Write a class that fulfils the following specifications. Class name Parameter(s) argument(s) for the constructor init AClassWard There is no parameter for this class constructor. Detailed description This class inherits the Ward class given in the template. Class attributes | 1. Override the class attributes as followed: The MAXIMUM_OCCUPANCY of an Aclassward is 1. Its DAILY_RATE IS 500 dollars instead of 35 dollars. 2. Define an additional class attribute: SLEEPER_UNIT_PRICE: float The default value for the SLEEPER_UNIT_PRICE is 100 dollars. Instance attribute | The class has an additional instance attribute: 1. has_sleeper_unit: bool The default value for this attribute is False. Example usage ward - Aclassward() print(AClassWard. MAXIMUM_OCCUPANCY) print(AClassWard.DAILY_RATE) print(ward. has_sleeper_unit) Example usage output 1 500 False Q5c. Override the instance method check in for the AclassWard class as follows. Method name check_in Parameter(s) 1. patient_name: str argument(s) 2. needs_sleep_unit: bool The second parameter, needs_sleep_unit, is an optional parameter and its default value is False. Return value This method does not have a return value Detailed Call the method of same name in the parent's class with patient_name description as the parameter. Use the parameter needs_sleep_unit to set the value of the instance attribute has_sleeper_unit. Example usage ward 2012 - AClassward() ward201a.check_in("Tom Harris", False) ward 2016 - AClassward() ward2016.check_in("Cassandra Green", True) print(ward2012.patients[0].name) print(ward201a.has_sleeper_unit) print(ward2016.patients[0].name) print(ward201b.has_sleeper_unit) Example usage Tom Harris output False Cassandra Green True Q5d. Override the instance method get_patient_cost for the Aclassward class Method name get_patient_cost 1. patient_name: str Parameter(s) argument(s) Return value 1. a float Detailed description Example usage Get the basic cost using the get_patient_cost method from the parent class with the necessary parameters. Return the sum of the basic cost and the product of the SLEEPER_UNIT_RATE and the instance's length of stay if the instance attribute has_sleeper_unit is True. Otherwise, return the basic cost. ward2012 - AClassWard() ward201a.check_in("Tom Harris", False) ward2016 - AClassWard() ward201b.check_in("Cassandra Green", True) ward2012.increment_length_of_stay ward201b.increment_length_of_stay() print(ward201a.get_patient_cost("Tom Harris")) print(ward2015.get_patient_cost("Cassandra Green")) Example usage output 500 600

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions