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