Ethan Song
Gentry-Kolen
COMSC 210
23 February 2020
Inheritance Lab Report
Assignment Description:
Create a class called Musicians to contain three functions string ( ), wind ( ) and perc ( ).
Each of these functions should initialize a string array to contain the following instruments:
- veena, guitar, sitar, sarod and mandolin under string ( )
- flute, clarinet saxophone, nadhaswaram and piccolo under wind ( )
- tabla, mridangam, bangos, drums and tambour under perc ( )
It should also display the contents of the arrays that are [Link] a derived class called
TypeIns to contain a function called get ( ) and show ( ). The get ( ) function must display a
means as follows:
Type of instruments to be displayed
a. String instruments
b. ind instruments
c. Percussion instruments
The show ( ) function should display the relevant detail according to our choice. The base class
variables must be accessible only to its derived classes.
Discussion:
• Solution: The program implements a base class called Musicians that contained the
arrays and the functions to assign and display the arrays, followed by a derived class
called Typeins which added functions to get and show the data stored in the arrays of
the base class.
• Flowchart:
Class: Musicians
Protected:
string stringArr[5];
string windArr[5];
string percArr[5];
Public:
Void strings()
Void wind()
Void perc()
Class: Typeins
Public:
Int get()
Void show()
• Major Implementation Issues:
o Properly deciding the access modifier for members of each class to adequately
allow proper permissions for the derived class and main class.
o Constructing a functioning UI that allows for effective input as well as efficiency.
• Screenshots:
• Known Bugs and Errors:
o When asking for user input, if the value is not 1,2, or 3, the program does not do
anything and keeps on asking the user for an input.
• Lessons Learned:
o What went well: The program was successfully implemented and allowed the
user to view each element in each array through a derived class.
o What will be done differently next time: Next time, the user interface should be
more seamless and smooth. Right now, the only way to quit was to type -1, but
perhaps next time I could make the user type “quit.”