Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Design and implement the following interface and class hierarchy ( shown in Figure 1 ) in C# to demonstrate the relationships and functions among various
Design and implement the following interface and class hierarchy shown in Figure in C# to
demonstrate the relationships and functions among various musical instruments in a typical
musical instrument shop.
Sheridan College Assignment
Page of
Figure : IFixable and IPlayable are two interfaces. MusicalInstrument,
StringFamily, PercussionFamily, and WoodwindFamily are all abstract classes.
Guitar, Harp, Drum, Xylophone, and Flute are concrete classes.
Most information handled andor returned by interface and abstract class methods are
presented in Table Use this table for information to be returned by your method
implementations within respective class.
Table : Information on musical instruments
Instrument Make
sound
Price How to play How to fix Pitch Type
Drum vibrating
stretched
membrane
$ by hitting the
membrane
replace the
membrane
Sonic pitch
Flute guiding a
stream of
air
$ by blowing into
the flute
NA: it cannot be
fixed
Fundamental
pitch is middle C
Guitar vibrating
strings
$ by strumming
the strings
replace the strings Low to high
pitch
IFixable
HowToFix: string
MakeSound : string
GetPrice: double
GetPitchType: string
MusicalInstrument
IPlayable
HowToPlay: string
Harp
StringFamily
Guitar Flute
PercussionFamily WoodwindFamily
Drum Xylophone
Sheridan College Assignment
Page of
Harp vibrating
strings
$ with the thumb
and
first three
fingers
replace the strings Has seven levels
of pitch
Xylophone through
resonators
$ with two
mallets
replace bars Each bar
produces
different pitch
Your implementation should:
iRequirement receive the price value for each instrument from the user to create an object
of that instrument other information for that instrument object eg make sound, how to
play, how to fix, and pitch type can be hard coded as per Table
iiRequirement display How to Play, How to Fix, Pitch type and Price information for the most
expensive instrument through comparing objects of all instruments.
iiiRequirement display the names of all instruments Drum Flute, Guitar, Harp, Xylophone
in descending order of price. You must override the ToString method to display the name of
an instrument.
ivRequirement receive an instrument family name eg String family, Percussion family or
Woodwind family from the user, and display how each instrument of that given family makes
sound.
Your implementation must also satisfy following requirements:
vRequirement You must demonstrate the use of IComparable interface and implement
its CompareTo method or IComparer interface and implement its Compare method
to find the instrument object with the highest price and sort them.
viRequirement You must demonstrate the use of one or more Collection eg a List of type
MusicalInstrument to hold objects of each concrete type of musical instrument Use the
CompareTo method that you may have overridden in MusicalInstrument class or
Compare method that you might have implemented in a separate helper class to find the
instrument object with the highest price and sort them in the collection. No operation on the
instruments should be hard coded meaning all operations must be done programmatically.
viiRequirement Your program must demonstrate proper modularization of code, C# industry
standard with proper comments, indentations, and naming convention.
viiiRequirement You must include the following information as commented at the beginning
of your main class file.
Assignment:
Name:
Id:
Sheridan College Assignment
Page of
ixRequirement You must test your application for multiple runs with different price
values for all instruments. Change the price value for each instrument to show that your
application works even if the price of instruments is updated. Take screenshots for at least
two runs showing inputsoutputs for Requirements
xRequirement In addition, you MUST submit all the screenshots as specified in
Submission Guideline.
Sample Output: On the above information of musical instruments in Table the output of a test
run should be as follows:
: Requirement :
Enter the price for Drum:
Enter the price for Flute:
Enter the price for Guitar:
Enter the price for Harp:
Enter the price for Xylophone:
: Requirement :
The most expensive instrument is: Drum
Drums cost is: $
Drum is played: by hitting the membrane
Drum fixing: replace the membrane
Drum pitch type: Sonic pitch
: Requirement :
Instruments in price descending order:
Drum Harp, Guitar, Flute, Xylophone
: Requirement :
Enter an instrument family:
Xylophone makes sound through resonators.
Drum makes sound vibrating stretched membrane
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