Question: Write Java code for the Radiator class. Ensure that information hiding principles are enforced. Include additional variables as necessary for implementing the functionality described for



Write Java code for the Radiator class. Ensure that information hiding principles are enforced. Include additional variables as necessary for implementing the functionality described for the class. An object-oriented application, written in Java, is being developed for simulating a heating system for a small building in Canada. The application has two major classes: Radiator and Room. . . . The following properties apply to the classes: A Radiator heats one Room. A Room can be heated by zero or up to 2 unique Radiators The Radiator class has the state: radiatorID (int) and isTurnedon (boolean). has a constructor that does not accept any arguments. generates unique integer values for the radiatorID starting from 1000 and increases in increments of 10 for each successive Radiator object. has its state as turned off initially. has one accessor method for the radiatorID has one public method, heats (Room rm), that associates a Room object with a Radiator object. No return values. The Room class has the state: roomName (String), seatingCapacity (int) and numRadiators (int). has a constructor that accepts a roomName and initialises the seatingCapacity to a default value of 15. has one public method isHeatedBy (..) that accepts and associates a Radiator object with the Room object. This method returns a String containing one of the following messages indicating whether the Radiator was successfully associated with the Room or not: "Radiator already added to room. "Radiator successfully added to room. "Cannot add Radiator. Room has maximum number of radiators
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
