Answered step by step
Verified Expert Solution
Question
1 Approved Answer
based on the above answer the following: 1. Rewrite the method isTemperatureOK (line 53) so that it returns false only when the passed value of
based on the above answer the following:
1. Rewrite the method isTemperatureOK (line 53) so that it returns false only when the passed value of the temperature argument is above the value of maxTemperature of any of the Jeans and TShirt objects present in the load array. (In other words, it can disregard any Socks objects present in the array.) Note: the implementation should work not matter what are the actual contents of the laundry array (line 11).
write the answer based on:
import clothing. *; import appliances.*; public class TestLaundry final double WASHER SIZE 10.0 public static void main(String[] args) { 10 Washer washer new Washer ((int)WASHER _SIZE); Clothing[ laundrynew Jeans (), new Jeans), new TShirt), new Socks (); 12 13 14 15 16 17 18 19 20 21 try for (Clothing garnment: laundry) washer.loadGarnment (garnment) j catch (WasherFulLException ex) l System.out.println ("WARNING: Washer is full. Cannot add any more garnments."); System.out.println (washer) System.out.println("Can wash proceed? " +washer.isTemperature0K (90.2)); 23 24 25.class WasherFullException ) package appliances; 26 27 28 29.import java. Lang. RuntimeException, 30 31 class Washer { 32 package appliances; import clothing.Clothing; private int capacity; private Clothing[] load private int loadSize-6; 34 35 36 37. 38 39 40 public Washer) t) public Washer (int capacity) { if (this.capacity 0:"capacity); 42 43 this.capacity capacity; this.loadnew Clothing[this.capacity]; 45 46 public void loadGarnment (Clothing garnment) throws WasherFullException f 47. if (loadSizeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started