Question: java Write the code for an Air Conditioner class with the following attributes: brand (String) - default is null location (String) - default is null

java
java Write the code for an Air Conditioner class with the following
attributes: brand (String) - default is null location (String) - default is
null acID (integer) - default is 0 ison (boolean) - default is

Write the code for an Air Conditioner class with the following attributes: brand (String) - default is null location (String) - default is null acID (integer) - default is 0 ison (boolean) - default is false (AC is off) units (String) - default is Celsius mode (String) - default is Cool room Temperature (double) - default is 24C desired Temperature (double) - default is 18C Ensure that information hiding principles are not violated! Write a simple no-argument constructor for the Air Conditioner class that initialises state of the attributes of the class. Write accessor methods for the following attributes: brand (String) location (String) acid (integer) ison (boolean) units (String) mode (String) room Temperature (double) desired Temperature (double) Write mutator methods for the following attributes: units (String) - value is either Fahrenheit or Celsius (default) mode (int) - input value is either 1, 2 or 3 which corresponds to Fan, Dry or Cool respectively. (Hint: research switch statements in Java for a quick implementation) For all methods, print error messages if the input does not conform to the ranges specified. Write the following methods to control the AirCondition object which return true if successful and false otherwise. turn Off (): Boolean turnOn(): Boolean Write a toString() method that returns the aggregated state of an AirConditioner object. The method signature is as follows: public String toString() Write a main class called Cooling System with the following structure: public class CoolingSystem public static void main(String[] args) { 1/code for steps 7 and onward goes here Ensure that the Cooling System class and the Air Conditioner class are in the same folders. In the Cooling System class: Brand Location Clo Turned on Carrier Atrium No Lennox 93 No Lobby Kitchen Trane Yes :) Create three AirConditioner objects with the state specified in the table above. :) Create an Air Conditioner array and add the Air Conditioner objects to the array ) Iterate through the array and print the state of each AirConditioner object in the array by invoking the toString() method on each object. Write a private method with the following method signature: private double convertCelsius ToFahrenheit (double celciusValue) This method should convert a Celsius value to Fahrenheit. . Write a private method with the following method signature: private double convertFahrenheitToCelcius(double fahrenheitValue) This method should convert a Fahrenheit value to Celsius. 1. Write a mutator method for the following attribute in the Air Conditioner class: desired Temperature (double) - allowable range is 15 to 30 C otherwise the default is used. This method should cater for the user entering a value that is in either Celsius or acid Turned on Units Mode Desired Temperature Yes Cool 19.5 93 Yes Fan 16.3 67 24.0 Fahrenheit and doing the appropriate conversion. No Dry Change the details of the AirConditioner objects as follows by invoking the appropriate methods of the class: Iterate through the array and print the state of each AirConditioner object in the array. Modify your Air Conditioner classes so that the Air Conditioner constructor initializes the state variables using input parameters of your choice. Modify the instance creation in the Cooling System class as appropriate. a. How does this impact on your work from step 8

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!