Question: Python 3.6. Find solution for each following : - Suppose there is a class AirConditioner. The class supports the following behaviors: turning the air conditioner
Python 3.6. Find solution for each following :
- 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 my_ac to an object of this class, which has already been created. Invoke a method to turn the air conditioner off.
- Suppose there is a class AirConditioner. The class supports the following behaviors: turning the air conditioner on, off, and setting the desired temperature. The following methods are provided for these behaviors: turn_on and turn_off, which accept no arguments and return no value, and set_temp, which accepts an int argument and returns no value.
There is a reference variable my_ac to an object of this class, which has already been created. Invoke a method telling the object to set the air conditioner to 72 degrees.
- Suppose there is a class AirConditioner. The class supports the following behaviors: turning the air conditioner on, off, setting the desired temperature, and telling the previously set temperature. The following methods are provided for these behaviors: turn_on and turn_off, which accept no arguments and return no value, set_temp, which accepts an int argument and returns no value, and get_temp, which accepts no value and returns an int.
There is a reference variable my_ac to an object of this class, which has already been created. There is also a variable called current_temp, which has already been initialized. Invoke a method using the reference variable which returns the previously set temperature of the air conditioner, and store the returned value in current_temp.
-Suppose there is a class AirConditioner. The class supports the following behaviors: turning the air conditioner on, off, and checking if the air conditioner is on or off. The following methods are provided for these behaviors: turn_on and turn_off, which accept no arguments and return no value, and is_on, which accepts no argument and returns a bool indicating whether the air conditioner is on or off.
There is a reference variable my_ac to an object of this class, which has already been created. There is also a variable status, which has already been initialized which refers to a bool. Invoke a method of this object using the reference variable, asking the object to tell whether the air conditioner is on or off, and store the result in status.
- Suppose there is a class AirConditioner. The class supports the following behaviors: turning the air conditioner on, off, and setting the desired temperature. The following methods are provided for these behaviors: turn_on and turn_off, which accept no arguments and return no value, and set_temp, which accepts an int argument and returns 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, and set the desired temperature to 69 degrees.
- Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that deactivates the alarm, and armed which contains a boolean describing whether or not the alarm is activated. Alarm has a function disarm that changes the value of armed to False if the user gives a parameter containing the string that represents the alarm's code. Call the disarm function on the Alarm object myAlarm and give it the code "93478".
-Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that deactivates the alarm, and armed which contains a boolean describing whether or not the alarm is activated. Alarm has a function changeCode that takes two parameters containing Strings, the first representing the current code, and the second representing the new code. If the user inputs the current code correctly, the value of code is changed to that of the new code. Call the changeCode function on the Alarm object myAlarm, whose current code is "3456", and change the code to "7921".
-Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that deactivates the alarm, and armed which contains a boolean describing whether or not the alarm is activated. Create an Alarm object called myAlarm with the code "12345".
-Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that deactivates the alarm, and armed which contains a boolean describing whether or not the alarm is activated. Create an Alarm object called myAlarm with the code "3579" and print the value of armed to standard output.
- Write the class Calculator including:
a function called addthat takes two numbers and returns their sum
a function called subtractthat takes two numbers and returns their difference (subtract the second from the first)
a function called multiply that takes two numbers and returns their product
a function called divide that takes two numbers and returns the value of the first divided by the second. If the second number is a zero, do not divide, and return "You can't divide by zero!"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
