Problem

Challenge exercise Modify your Heater class to define three new doubleprecision floating...

Challenge exercise Modify your Heater class to define three new doubleprecision floating point fields: min, max, and increment. The values of min and max should be set by parameters passed to the constructor. The value of increment should be set to 5.0 in the constructor. Modify the definitions of warmer and cooler so that they use the value of increment rather than an explicit value of 5.0. Before proceeding further with this exercise, check that everything works as before. Now modify the warmer method so that it will not allow the temperature to be set to a value greater than max. Similarly modify cooler so that it will not allow temperature to be set to a value less than min. Check that the class works properly. .

Now add a method, setIncrement, that takes a single parameter of the appropriate type and uses it to set the value of increment. Once again, test that the class works as you would expect it to by creating some Heater objects within BlueJ. Do things still work as expected if a negative value is passed to the setIncrement method? Add a check to this method to prevent a negative value from being assigned to increment.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT