Assume there is a class AirConditioner that supports the following behaviors : turning the air conditioner on and off, and setting the desired temperature. The following methods provide these behaviors : turnOn and turnOff, which accept no arguments and return no value , and setTemp, which accepts an int argument and returns no value.
LANGUAGE: JAVA
CHALLENGE:
Assume there is a class AirConditioner that supports the following behaviors : turning the air conditioner on and off, and setting the desired temperature. The following methods provide these behaviors : turnOn and turnOff, which accept no arguments and return no value , and setTemp, which accepts an int argument and returns no value.
Assume there is a reference variable officeAC of type AirConditioner. Create a new object of type AirConditioner and save the reference in officeAC. After that, use the reference to turn on the new air conditioner object and set the desired temperature to 69 degrees.
SOLUTION:
LANGUAGE: JAVA
CHALLENGE:
Assume there is a class AirConditioner that supports the following behaviors : turning the air conditioner on and off, and setting the desired temperature. The following methods provide these behaviors : turnOn and turnOff, which accept no arguments and return no value , and setTemp, which accepts an int argument and returns no value.
Assume there is a reference variable officeAC of type AirConditioner. Create a new object of type AirConditioner and save the reference in officeAC. After that, use the reference to turn on the new air conditioner object and set the desired temperature to 69 degrees.
SOLUTION:
officeAC = new AirConditioner(); officeAC.turnOn(); officeAC.setTemp(69);