Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

B1. Consider the following class UML where two patterns are used: adapter pattern and composite pattern. Write the required java code to implement all classes

B1. Consider the following class UML where two patterns are used: adapter pattern and composite pattern.

image text in transcribed

Write the required java code to implement all classes in the above class diagram.

The classes Card, DeviceCard and SoundCard are abstracts. The methods inside them are also abstracts.

StartMachine() is used to start all the cards contained inside the object Machine.

For the class ExtensionSlot, the methods Add, Remove and GetChild manage the contained components. Start() and Stop() are used to respectively start and stop the contained components.

The class SoundCardAdapter methods start or stop the VendorSoundCard using respectively the methods StartVendorSoundCard() and StopVendorSoundCard().

Add the constructors when needed.

Card Machine +Start() +Stop() +StartMachine() cards cards DeviceCard +Start() +Stop() Extension Slot +Start() +Add(c: Card) +Remove(c: Card) +GetChild(index : Int) +Stop() SoundCard +Start() +Stop() Sound Card Adapter +Start() +Stop() Vendor SoundCard +StartVendor SoundCard() +Stop Vendor SoundCard)

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

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions

Question

=+j Enabling a productive global workforce.

Answered: 1 week ago