Suppose there is a class AirConditioner . The class supports the following behav
ID: 3551904 • Letter: S
Question
Suppose there is a class AirConditioner . The class supports the following behaviors: turning the air conditioner on and off. The following methods are provided for these behaviors: turn_on and turn_off . Both methods accept no arguments and return no value.
There is a reference variable office_a_c of type AirConditioner . Create a new object of type AirConditioner using the office_a_c reference variable . After that, turn the air conditioner on using the reference to the new object.
Can i get this for python please?
Explanation / Answer
#Suppose there is a class AirConditioner . The class supports the following behaviors: turning the air conditioner on and off.
#The following methods are provided for these behaviors: turn_on and turn_off . Both methods accept no arguments and return no value.
class AirConditioner:
def __init__(self):
self.is_on = False
def turn_on(self):
self.is_on = True
def turn_off(self):
self.is_on = False
def is_on_off(self):
return self.is_on;
#There is a reference variable office_a_c of type AirConditioner . Create a new object of type AirConditioner using the office_a_c reference variable .
#After that, turn the air conditioner on using the reference to the new object.
office_a_c = AirConditioner();
new_object = office_a_c;
new_object.turn_on();
print(new_object.is_on_off())
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.