Question: 1 5 . 8 LAB: Instrument information ( derived classes ) Given the base class Instrument, define a derived class StringInstrument for string instruments with

15.8 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
2015
2500
Guitar
Gibson
2002
1200
6
19
False
the output is:
Instrument Information:
Name: Drums
Manufacturer: Zildjian
Year built: 2015
Cost: 2500
Instrument Information:
Name: Guitar
Manufacturer: Gibson
Year built: 2002
Cost: 1200
Number of strings: 6
Number of frets: 19
Is bowed: False
532868.4047542.qx3zqy7
LAB ACTIVITY
15.8.1: LAB: Instrument information (derived classes)
7/10
main.py
Load default template...
num_frets =int(input())
Develop mode
Submit mode
When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading.
Submit for grading
Coding trail of your work
What is this?
4/25
R
-
0
,0
,0
,0
,0
,0
,0
,0
,0
,6
,4
,0
,6
,7
,7
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
,0
min:17
Latest submission -8:11 PM CDT on 04/25/24
Total score: 0/10
Download this submission
1:Compare output
0/1
Output is nearly correct, but whitespace differs. See highlights below.
Special character legend
Input
Drums
Zildjian
2015
2500
Guitar
Gibson
2002
1200
6
19
False
Your output
Instrument Information:
Name: Drums
Manufacturer: Zildjian
Year built: 2015
Cost: 2500
Instrument Information:
Name: Guitar
Manufacturer: Gibson
Year built: 2002
Cost: 1200
Number of strings: 6
Number of frets: 19
Is bowed: False
Expected output
Instrument Information:
Name: Drums
Manufacturer: Zildjian
Year built: 2015
Cost: 2500
Instrument Information:
Name: Guitar
Manufacturer: Gibson
Year built: 2002
Cost: 1200
Number of strings: 6
Number of frets: 19
Is bowed: False
2:Compare output
0/2
Output differs. See highlights below.
Special character legend
Input
Piano
Yamaha
1979
10000
Cello
Knilling
2021
6899
4
0
True
Your output
Instrument Information:
Name: Piano
Manufacturer: Yamaha
Year built: 1979
Cost: 10000
Instrument Information:
Name: Cello
Manufacturer: Knilling
Year built: 2021
Cost: 6899
Number of strings: 4
Number of frets: 0
Is bowed: False
Expected output
Instrument Information:
Name: Piano
Manufacturer: Yamaha
Year built: 1979
Cost: 10000
Instrument Information:
Name: Cello
Manufacturer: Knilling
Year built: 2021
Cost: 6899
Number of strings: 4
Number of frets: 0
Is bowed: True
3:Compare output
0/1
Output is nearly correct, but whitespace differs. See highlights below.
Special character legend
Input
Clarinet
Yamaha
2017
1371
Ukulele
Kala
2018
50
6
12
False
Your output
Instrument Information:
Name: Clarinet
Manufacturer: Yamaha
Year built: 2017
Cost: 1371
Instrument Information:
Name: Ukulele
Manufacturer: Kala
Year built: 2018
Cost: 50
Number of strings: 6
Number of frets: 12
Is bowed: False
Expected output
Instrument Information:
Name: Clarinet
Manufacturer: Yamaha
Year built: 2017
Cost: 1371
Instrument Information:
Name: Ukulele
Manufacturer: Kala
Year built: 2018
Cost: 50
Number of strings: 6
Number of frets: 12
Is bowed: False
4:Unit test
0/2
Tests constructor StringInstrument('Guitar', 'Gibson', 2002,1200,6,19, False) sets my_string_instrument.num_strings =6
TypeError: StringInstrument.__init__() takes 7 positional arguments but 8 were given
5:Unit test
0/2
Tests constructor StringInstrument('Guitar', 'Gibson', 2002,1200,6,22, False) sets my_string_instrument.num_frets =22
TypeError: StringInstrument.__init__() takes 7 positional arguments but 8 were given
6:Unit test
0/2
Tests constructor StringInstrument('Viola', 'Yamaha', 2012,1200,4,0, True) sets my_string_instrument.is_bowed = True
TypeError: StringInstrument.__init__() takes 7 positional arguments but 8 were given15.8 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:15.8 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
1 5 . 8 LAB: Instrument information ( derived

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 Programming Questions!