Question
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
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