Question: Programming Language in Python Q5 There are four parts to this question. You will need to use the Patient class and the Ward class that

Programming Language in Python

Programming Language in Python 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

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 AClassWard 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 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) argument(s) 1. patient_name: str 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 description Call the method of same name in the parent's class with patient_name as the parameter. Use the parameter needs_sleep_unit to set the value of the instance attribute has_sleeper_unit. Example usage ward2012 - AClassward() ward201a.check_in("Tom Harris", False) ward201b = AClassward() ward2016.check_in("Cassandra Green", True) print(ward2012.patients[0].name) print(ward201a.has_sleeper_unit) print(ward2016.patients[0].name) print(ward2016. has_sleeper_unit) Example usage output Tom Harris False Cassandra Green True Q5d. Override the instance method get_patient_cost for the Aclassward class Method name get_patient_cost Parameter(s) argument(s) 1. patient_name: str 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) ward201b = AClassWard() ward2016.check_in("Cassandra Green", True) ward2012. increment_length_of_stay() ward2016.increment_length_of_stay () print(ward2012.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 AClassWard 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 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) argument(s) 1. patient_name: str 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 description Call the method of same name in the parent's class with patient_name as the parameter. Use the parameter needs_sleep_unit to set the value of the instance attribute has_sleeper_unit. Example usage ward2012 - AClassward() ward201a.check_in("Tom Harris", False) ward201b = AClassward() ward2016.check_in("Cassandra Green", True) print(ward2012.patients[0].name) print(ward201a.has_sleeper_unit) print(ward2016.patients[0].name) print(ward2016. has_sleeper_unit) Example usage output Tom Harris False Cassandra Green True Q5d. Override the instance method get_patient_cost for the Aclassward class Method name get_patient_cost Parameter(s) argument(s) 1. patient_name: str 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) ward201b = AClassWard() ward2016.check_in("Cassandra Green", True) ward2012. increment_length_of_stay() ward2016.increment_length_of_stay () print(ward2012.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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!