1. Create a new BlueJ project named LastName-heater using your last name. 2. Create a class named Heater · At the top of the source code for Heater, add documentation like this: /** * Heater project *...

Refer to attachment


1. Create a new BlueJ project named LastName-heater using your last name. 2. Create a class named Heater · At the top of the source code for Heater, add documentation like this: /**  * Heater project  * Simulate the behavior of a heater (thermostat)  *  * Modifications:  * List the modifications as you make them  *  * @author Your Name  * @version The Date  */ 3. Add the following 4 int fields: · temperature · minimum · maximum · increment 4. Write getters (accessors) and setters (mutators) for each field using standard naming conventions, e.g., getTemperature and setTemperature for the temperature field. You should add a total of 8 methods from this step. · Whenever you add a new method, include a documentation block that describes what the method does. For example: /**  * @return current temperature of the heater  */ · Modify the setIncrement method so that it does not allow a negative value for the increment. Print an error message if the value given is negative and leave the increment unchanged. 5. Define two constructors for the class: · The first constructor takes no parameters. In this constructor, initialize minimum to 0, maximum to 100, increment to 1, and temperature to 50. · The second constructor takes 4 parameters and uses them to initialize the fields temperature, minimum, maximum, and increment. · Be sure to add a javadoc documentation block for each constructor. 6. Define a method named warmer. This method takes no parameters and raises the temperature by the value of the increment field. However, it should not allow the temperature to go above maximum. If the temperature would go above maximum, print an error message and do not raise the temperature. For example: · If temperature=50, increment=3, and maximum=100, after a call to the warmer method, temperature will be 53. · If temperature=98, increment=3, and maximum=100, after a call to the warmer method, temperature is still 98 and an error message is printed. 7. Define a method named cooler. This method takes no parameters and lowers the temperature by the value of the increment field. However, it should not allow the temperature to go below minimum. If the temperature would go below minimum, print an error message and do not lower the temperature. 8. Adhere to Java style guidelines as described in Appendix J. 9. Test your code thoroughly! (Don't wait until this step - you should be testing each piece as you go.)
Mar 01, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here