Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is DryerSettings.java package m02; /** * Specifies the heat settings for a laundry dryer. * * @author CSIS Starter Code * */ public enum

image text in transcribedThis is DryerSettings.java

package m02; /** * Specifies the heat settings for a laundry dryer. * * @author CSIS Starter Code * */ public enum DryerSetting { LOW, MEDIUM, HIGH }

Setting up the project ( 2 points )

Create a new Java project called Module02Test. Add a package called m02 and inside this package, a class Module02 that includes a main method. Add DryerSetting.java Download DryerSetting.java to the package. This enum class is provided for you. Soon you will add more files as you implement the classes shown in the UML class diagram.

Style | Doc Comments | Best Practices (5 points)

Follow the guidelines and expectations regarding style and best practices. Please pay special attention to doc comments (2 out of 5 points) Other areas to focus on: using @Override whenever overriding methods, adding a single empty line after each method declaration, use of descriptive names, removing //TODO comments once a method has been implemented, grouping, and proper indentation,

Requirements:

Implement the classes as specified in the UML Class Diagram and the instructions below.

Part 1: (max 15 points)

Declare the classes, fields, constructors, and methods as specified in the UML class diagram.

All classes should be declared public. Please pay close attention to details like -, +, #, arrowheads, use of italic, etc. Note that there is only one word written in italic; I used a different font to make it stand out. Important: No fields, constructors, or methods should be added, removed, or changed.

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

Part 3: (max 8 points)

Class Module02:

Class Module02 is the test client and it includes the main method. Add the following array to the main method.

Washer[] washers = {

new WasherDryer("LG", true, false), new TopLoader("Maytag", false, false), new TopLoader("Whirlpool", true, true), new WasherDryer("KoolMore", false, true) };

Loop through all the elements in the array. For each element do the following: (2 out of 8 points)

Print the information about the washer provided by the toString method (1 out of 8 points)

Select a random temperature between 70 and 130 degrees. (70 inclusive, 130 exclusive) Display how the washer washes at the given temperature. (2 out of 8 points)

If the washer is a washer/dryer combo, display how the dryer dries with medium heat. (2 out of 8 points)

Add white space as necessary to match the formatting of the Sample Output. (1 out of 8 points)

IMPORTANT: If I initialize the list with different washers, the output needs to change accordingly

Sample Output

Note that your degrees will vary because they are chosen randomly.

WasherDryer LG * not vented Washing at 119F Drying with medium heat

TopLoader Maytag not removable Washing at 78F

TopLoader Whirlpool * removable Washing at 71F

WasherDryer KoolMore vented Washing at 90F Drying with medium heat

Part 2: (max 21 points)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions