Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have been asked to design the architecture for a washing machine simulator. There are four types of washing machines: a basic washer a premium

You have been asked to design the architecture for a washing machine simulator. There are four types of washing machines: a basic washer a premium washer a deluxe washer a smart washer. All washing machines can wash clothes based on a setting selected by a user. A basic washer allows only soap powder to be added. A premium washer only allows liquid soap to be added. A deluxe washer uses only liquid soap but also allows fabric softener to be added and dispensed. A smart washer alerts the user when the wash cycle is finished via a message.

FIGURE 1

public interface WashingMachine{

boolean wash (int setting);

void addSoapPowder(Powder p);

void addLiquidSoap(LiquidSoap ls);

void addFabricSoftener(FabricSoftener fs);

Message alert( ); }

(a) Explain the problem with having the interface shown in Figure 1, to specify the behaviour for the four types of washing machines?

b) Which SOLID object-oriented design principle is violated in the interface shown in Figure 1?

(c) Suggest how the interface in Figure 1 can be refactored to adhere to the principles identified in part (b).

(d) Draw a UML class diagram to model a solution for the washing machine domain in the scenario based on your answers in part

(c)You may use the method signatures in Figure 1.

(e) A SencilloWasher is a basic washing machine that only uses soap powder. Draw a sequence diagram to illustrate the interaction between a user and SencilloWasher.

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

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions