Create a class named AirConditioner in its own file. (The main method should be in a different file.) The class should contain the following: • Three public constants named HIGH, MEDIUM, and LOW with values of 1, 2, and 3 to denote the air conditioner fan speed. • A private int data field named speed that specifies the speed of the air conditioner fan. (The default is 1 for high.) • A private boolean data field named on that specifies whether the air conditioner is on or not. (The default is false.) · A private double data field named temperature that specifies the temperature setting of the air conditioner. (The default is 72.0.) • A private String data field named model that specifies the model name of the air conditioner. (The default is "Iceberg".) • The accessor and mutator methods (getters and setters) for all four data fields. • A no-arg constructor that creates a default air conditioner, with all the default settings. (Do not create a full constructor or any other constructor except the no-arg constructor.) • A method named toString) that returns a string description of the air conditioner. • If the air conditioner is on, the method returns the model, the current temperature setting and fan speed in words. Example: "The Iceberg is currently set to 68 degrees Fahrenheit with fan set to medium." • If the air conditioner is off, the method returns the air conditioner model and the message that it is off. Example: "The Iceberg is currently turned off." In main, create two AirConditioner objects. For the first one, make its model the Friginator, the fan speed medium, and the temperature 69.5 degrees. For the second one, make it the Iceberg with the fan speed high and the temperature 72.0 degrees. Assume that both objects are on. Then simply display each object by invoking their toString method. Here are some hints: • You may want to sketch a UML diagram for the AirConditioner class, but you do not have to turn that in. • In main, use the AirConditioner's setters to change the values of the fields, since you cannot have a full constructor. • Create the public speed constants in the AirConditioner class and then use them in main to set the fan speed of your AirConditioner object. You can access them like any static member. For example, to set a myAC's speed to low in main, you can say: myAC.setSpeed(AirConditioner.LOW);

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Hello,

Please assist with the attached java question. Thanks. 

Create a class named AirConditioner in its own file. (The main method should be in a different file.) The class should contain the following:
• Three public constants named HIGH, MEDIUM, and LOW with values of 1, 2, and 3 to denote the air conditioner fan speed.
• A private int data field named speed that specifies the speed of the air conditioner fan. (The default is 1 for high.)
A private boolean data field named on that specifies whether the air conditioner is on or not. (The default is false.)
• A private double data field named temperature that specifies the temperature setting of the air conditioner. (The default is 72.0.)
A private String data field named model that specifies the model name of the air conditioner. (The default is "Iceberg".)
• The accessor and mutator methods (getters and setters) for all four data fields.
• A no-arg constructor that creates a default air conditioner, with all the default settings. (Do not create a full constructor or any other constructor except the no-arg constructor.)
• A method named toString() that returns a string description of the air conditioner.
• If the air conditioner is on, the method returns the model, the current temperature setting and fan speed in words.
Example: "The Iceberg is currently set to 68 degrees Fahrenheit with fan set to medium."
• If the air conditioner is off, the method returns the air conditioner model and the message that it is off.
Example: "The Iceberg is currently turned off."
In main, create two AirConditioner objects. For the first one, make its model the Friginator, the fan speed medium, and the temperature 69.5 degrees. For the second one, make it the Iceberg with the fan speed high and the
temperature 72.0 degrees. Assume that both objects are on. Then simply display each object by invoking their toString method.
Here are some hints:
• You may want to sketch a UML diagram for the AirConditioner class, but you do not have to turn that in.
• In main, use the AirConditioner's setters to change the values of the fields, since you cannot have a full constructor.
• Create the public speed constants in the AirConditioner class and then use them in main to set the fan speed of your AirConditioner object. You can access them like any static member. For example, to set a myAC's speed to
low in main, you can say: myAC.setSpeed(AirConditioner.LOW);
Transcribed Image Text:Create a class named AirConditioner in its own file. (The main method should be in a different file.) The class should contain the following: • Three public constants named HIGH, MEDIUM, and LOW with values of 1, 2, and 3 to denote the air conditioner fan speed. • A private int data field named speed that specifies the speed of the air conditioner fan. (The default is 1 for high.) A private boolean data field named on that specifies whether the air conditioner is on or not. (The default is false.) • A private double data field named temperature that specifies the temperature setting of the air conditioner. (The default is 72.0.) A private String data field named model that specifies the model name of the air conditioner. (The default is "Iceberg".) • The accessor and mutator methods (getters and setters) for all four data fields. • A no-arg constructor that creates a default air conditioner, with all the default settings. (Do not create a full constructor or any other constructor except the no-arg constructor.) • A method named toString() that returns a string description of the air conditioner. • If the air conditioner is on, the method returns the model, the current temperature setting and fan speed in words. Example: "The Iceberg is currently set to 68 degrees Fahrenheit with fan set to medium." • If the air conditioner is off, the method returns the air conditioner model and the message that it is off. Example: "The Iceberg is currently turned off." In main, create two AirConditioner objects. For the first one, make its model the Friginator, the fan speed medium, and the temperature 69.5 degrees. For the second one, make it the Iceberg with the fan speed high and the temperature 72.0 degrees. Assume that both objects are on. Then simply display each object by invoking their toString method. Here are some hints: • You may want to sketch a UML diagram for the AirConditioner class, but you do not have to turn that in. • In main, use the AirConditioner's setters to change the values of the fields, since you cannot have a full constructor. • Create the public speed constants in the AirConditioner class and then use them in main to set the fan speed of your AirConditioner object. You can access them like any static member. For example, to set a myAC's speed to low in main, you can say: myAC.setSpeed(AirConditioner.LOW);
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

How do I resolve the error below in intellij IDE please ?

Error: Could not find or load main class jj.Main
Caused by: java.lang.ClassNotFoundException: omollo.Main

Process finished with exit code 1

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning