Question: 1 5 . 8 LAB: Instrument information ( derived classes ) Given the base class Instrument, define a derived class StringInstrument for string instruments with
LAB: Instrument information derived classes
Given the base class Instrument, define a derived class StringInstrument for string instruments with a constructor that initializes the attributes of the Instrument class as well as new attributes of the following types
integer to store the number of strings
integer to store the number of frets
boolean to store whether the instrument is bowed
Ex If the input is:
Drums
Zildjian
Guitar
Gibson
False
the output is:
Instrument Information:
Name: Drums
Manufacturer: Zildjian
Year built:
Cost:
Instrument Information:
Name: Guitar
Manufacturer: Gibson
Year built:
Cost:
Number of strings:
Number of frets:
Is bowed: False
qxzqy
LAB ACTIVITY
: LAB: Instrument information derived classes
main.py
Load default template...
numfrets intinput
Develop mode
Submit mode
When done developing your program, press the Submit for grading button below. This will submit your program for autograding.
Submit for grading
Coding trail of your work
What is this?
R
min:
Latest submission : PM CDT on
Total score:
Download this submission
:Compare output
Output is nearly correct, but whitespace differs. See highlights below.
Special character legend
Input
Drums
Zildjian
Guitar
Gibson
False
Your output
Instrument Information:
Name: Drums
Manufacturer: Zildjian
Year built:
Cost:
Instrument Information:
Name: Guitar
Manufacturer: Gibson
Year built:
Cost:
Number of strings:
Number of frets:
Is bowed: False
Expected output
Instrument Information:
Name: Drums
Manufacturer: Zildjian
Year built:
Cost:
Instrument Information:
Name: Guitar
Manufacturer: Gibson
Year built:
Cost:
Number of strings:
Number of frets:
Is bowed: False
:Compare output
Output differs. See highlights below.
Special character legend
Input
Piano
Yamaha
Cello
Knilling
True
Your output
Instrument Information:
Name: Piano
Manufacturer: Yamaha
Year built:
Cost:
Instrument Information:
Name: Cello
Manufacturer: Knilling
Year built:
Cost:
Number of strings:
Number of frets:
Is bowed: False
Expected output
Instrument Information:
Name: Piano
Manufacturer: Yamaha
Year built:
Cost:
Instrument Information:
Name: Cello
Manufacturer: Knilling
Year built:
Cost:
Number of strings:
Number of frets:
Is bowed: True
:Compare output
Output is nearly correct, but whitespace differs. See highlights below.
Special character legend
Input
Clarinet
Yamaha
Ukulele
Kala
False
Your output
Instrument Information:
Name: Clarinet
Manufacturer: Yamaha
Year built:
Cost:
Instrument Information:
Name: Ukulele
Manufacturer: Kala
Year built:
Cost:
Number of strings:
Number of frets:
Is bowed: False
Expected output
Instrument Information:
Name: Clarinet
Manufacturer: Yamaha
Year built:
Cost:
Instrument Information:
Name: Ukulele
Manufacturer: Kala
Year built:
Cost:
Number of strings:
Number of frets:
Is bowed: False
:Unit test
Tests constructor StringInstrumentGuitar 'Gibson', False sets mystringinstrument.numstrings
TypeError: StringInstrument.init takes positional arguments but were given
:Unit test
Tests constructor StringInstrumentGuitar 'Gibson', False sets mystringinstrument.numfrets
TypeError: StringInstrument.init takes positional arguments but were given
:Unit test
Tests constructor StringInstrumentViola 'Yamaha', True sets mystringinstrument.isbowed True
TypeError: StringInstrument.init takes positional arguments but were given LAB: Instrument information derived classes
Given the base class Instrument, define a derived class StringInstrument for string instruments with a constructor that initializes
the attributes of the Instrument class as well as new attributes of the following types
integer to store the number of strings
integer to store the number of frets
boolean to store whether the instrument is bowed
Ex If the input is:
the output is: LAB: Instrument information derived classes
Given the base class Instrument, define a derived class StringInstrument for string instruments with a constructor that initializes
the attributes of the Instrument class as well as new attributes of the following types
integer to store the number of strings
integer to store the num
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
