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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!