Question
PYTHON Add the missing code so that the following actions are completed: DrummerFactory is a subclass of MusicianFactory A DrummerFactory creates a Musician with a
PYTHON
Add the missing code so that the following actions are completed:
DrummerFactory is a subclass of MusicianFactory
A DrummerFactory creates a Musician with a Drum
A Drum makes a Bang! noise when it is played
A Musician plays their instrument in playInstrument. This should return the sound of the instrument played.
If a Musician starts playing music for a second time, it should throw an Exception with the message Already playing!
Here's the code
class MusicianFactory: # Creates a Musician # returns the created Musician def createMusician(self): return None
class Instrument: # Plays the Instrument # returns the instrument's sound def play(self): return None
class DrummerFactory: pass;
class Drum: pass;
class Musician: def __init__(self, instrument): raise Exception('Waiting to be implemented!')
def playInstrument(self): raise Exception('Waiting to be implemented!')
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