Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ please help by showing working program. clearer instructions have already been uploaded. search Q&A for Need help with the C++ program. please show
C++ please help by showing working program. clearer instructions have already been uploaded. search Q&A for
" Need help with the C++ program. please show it working, it should use prog7client.cpp prog7instrument.cpp prog7brass.cpp prog7string.cpp for the g++. "
Program #7 DUE: Specified on Canvas Program Purpose For this program you are asked to use C++ inheritance to create a base class and two derived lasses You will also be working with construcors and redefining/ovedoading class member functions Mandatory Instructions 1. Design a Masicalinsment dass that has the following members A mamber variable for the name of the instrument (string) -A member variable for the cost the instrument (double) - A default constructor that sets the name to the empty string and the aost to zero An overloeded constructor that accepts values for the name and cost and assigns them to the duta members - Accessors and mutators for the name and cost A virtual display fiunction display Instrument that displays the instrument's name and the dost Store the declaration for this class in a file called prog Tinstrumenth. Implament funcations in epp file 2. Design a Brassins trument class that is derived from the Musical io strument class with A mamber variable for the method of sound making (string): slides, valves, - Amember variable for the material from which the instrument is made (stongi brass or wood - A default constructor that invokes the Musicallrnstrument default constructor to initialize the inher ited data members and sets he Bras sin strnment fields to empty string - A second constructor that accepts an instrument's name, cost, method of making sound, and materal fom which it as made Pass the first two arguments to the Musicalinstrument construtor and use the last twe to set the Brassiestrment data membrs A displaylastrument function that overrides the displaylastrument function in the hase class It should display the instrument's name, cost, method of mak ing sound, and material from which it is made Store the declaration for the BrassInstrument class in the file progTbras.&.Implemanst functions in cpp file of same name 3. Design a Strnginstrument class that is derived frogn the Musicalinstramernt class with - Amember variable for the flag to indicate abowed instrument (bool) - Amamber variable for the number of - A defnult constructor that invokes t bowed fag to faise and number of strings to zero nt) default constructor to initialixe the inhenited data members and sets name, oost, bowed flag, and number of strings Pass the first two A second constructor that acceptsa arguments to the Msicallnstrumentconstructr and use the last two to set the Stringins mnt's data members . A displaylestrument dass's function (to display the displayl nstrument function in the hase class It should tirst call the hase s name and cost) and then display the string instrument's data members nr class in the file prog7string.h. Implement functions in epp file of same na Store the dechration progidientepp to demons trate the thre musical instrument classes Define an am of peicrs to to store pointers of up to fifeen Afusicalin strumen, Brasslnstrument o String sinentobects 4. Wribe data from the file prog? txt. an B'rass instrument or S'tring instrumant For each set of instrument data it contains a code to indkale whether the daa tht If B' then the instrument's name, cost, method of making sound, and material are also induded in the data file If the code is "S" then the code is followed by the instrument's rume, cost, bowed flag(1 for true, O Rw false) and number of Use the mew operator to create either a Brassinstrument or a Saringinssnument object, storing the pomeer to the object in the next dement of the army 6. In your header file for the Adusicaliustrumenr class, make your displayinstrument function virtual Then wise a loop to display the data for all of the instrument data stored in the arrayStep 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