Question: Part 2: (max 21 points) Implement the constructors and methods based on the following descriptions. Important: No functionality should be added, removed, or changed. Class
Part 2: (max 21 points)
Implement the constructors and methods based on the following descriptions. Important: No functionality should be added, removed, or changed.
Class Washer: ( max 8 points)
Constructor: (2 out of 8 points) Initializes the fields. No need to implement input validation.
Method wash (2 out of 8 points) It should return the following string: Washing at {temperature}F where {temperature} is the temperature passed as an argument
Method toString: (4 out of 8 points) It should return a string of the following format: {class name} {brand}{energyStarIndicator} where {class name} is the name of the class, {brand} is substituted by the corresponding field value, and {energyStarIndicator} is substituted with a space and an asterisk if the washer is energy start certified. Nothing should be added after the brand if the washer is not energy star certified.
Class WasherDryer: (max 9 points)
Constructor: (2 out of 9 point) Initializes the field(s).
Method dry: (5 out of 9 point) Based on the dryer setting provided by the user, this method should return one of the following strings: Drying with low heat Drying with medium heat Drying with high heat Note, that low, medium, and high are spelled in lower-case letters.
Method toString: (2 out of 9 point) It should return a string of the following format: {class name} {brand}{energyStarIndicator} {ventedIndicator} where {ventedIndicator} is substituted vented or not vented depending on whether the washer is vented or not. Examples: WasherDryer LG * not vented WasherDryer KoolMore vented
Class TopLoader: (max 4 points)
Constructor: (2 point) Initializes the field(s).
Method toString: (2 points) It should return a string of the following format: {class name} {brand}{energyStarIndicator} {ventedIndicator} where {removableAgitatorIndicator} is substituted removable or not removable depending on whether the washer has a removable agitator or not. Examples: TopLoader Maytag not removable TopLoader Whirlpool * removable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
