subject

Given main() and the Instrument class, define a derived class, StringInstrument, for string instruments. Ex. If the input is:
Drums
Zildjian
2015
2500
Guitar
Gibson
2002
1200
6
19
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
//main. cpp
#include "StringInstrument. h"
int main() {
Instrument myInstrument;
StringInstrument myStringInstrument;
string instrumentName, manufacturerName, stringInstrumentName, stringManufacturer, yearBuilt,
cost, stringYearBuilt, stringCost, numStrings, numFrets;
getline(cin, instrumentName);
getline(cin, manufacturerName);
getline(cin, yearBuilt);
getline(cin, cost);
getline(cin, stringInstrumentName);
getline(cin, stringManufacturer);
getline(cin, stringYearBuilt);
getline(cin, stringCost);
getline(cin, numStrings);
getline(cin, numFrets);
myInstrument. SetName(instrumentName);
myInstrument. SetManufacturer(manufacturerName);< br /> myInstrument. SetYearBuilt(yearBuilt);
myInstrument. SetCost(cost);
myInstrument. PrintInfo();
myStringInstrument. SetName(stringInstrumentName);
myStringInstrument. SetManufacturer(stringManufacturer) ;
myStringInstrument. SetYearBuilt(stringYearBuilt);
myStringInstrument. SetCost(stringCost);
myStringInstrument. SetNumOfStrings(numStrings);
myStringInstrument. SetNumOfFrets(numFrets);
myStringInstrument. PrintInfo();
cout << " Number of strings: " << myStringInstrument. GetNumOfStrings() << endl;
cout << " Number of frets: " << myStringInstrument. GetNumOfFrets() << endl;
}
//Instrument. h
#ifndef INSTRUMENTH
#define INSTRUMENTH
#include
#include
using namespace std;
class Instrument {
protected:
string instrumentName;
string instrumentManufacturer;
string yearBuilt;
string cost;
public:
void SetName(string userName);
string GetName();
void SetManufacturer(string userManufacturer);
string GetManufacturer();
void SetYearBuilt(string userYearBuilt);
string GetYearBuilt();
void SetCost(string userCost);
string GetCost();
void PrintInfo();
};
#endif
//Instrument. cpp
#include "Instrument. h"
void Instrument::SetName(string userName) {
instrumentName = userName;
}
string Instrument::GetName() {
return instrumentName;
}
void Instrument::SetManufacturer(string userManufacturer) {
instrumentManufacturer = userManufacturer;
}
string Instrument::GetManufacturer() {
return instrumentManufacturer;
}
void Instrument::SetYearBuilt(string userYearBuilt) {
yearBuilt = userYearBuilt;
}
string Instrument::GetYearBuilt() {
return yearBuilt;
}
void Instrument::SetCost(string userCost) {
cost = userCost;
}
string Instrument::GetCost() {
return cost;
}
void Instrument::PrintInfo() {
cout << "Instrument Information: " << endl;
cout << " Name: " << instrumentName << endl;
cout << " Manufacturer: " << instrumentManufacturer << endl;
cout << " Year built: " << yearBuilt << endl;
cout << " Cost: " << cost << endl;
}
//StringInstrument. h
#ifndef STR_INSTRUMENTH
#define STR_INSTRUMENTH
#include "Instrument. h"
class StringInstrument : public Instrument {
// TODO: Declare private data members: numStrings, numFrets
// TODO: Declare mutator functions -
// SetNumOfStrings(), SetNumOfFrets()
// TODO: Declare accessor functions -
// GetNumOfStrings(), GetNumOfFrets()
};
#endif
//StringInstrument. cpp
#include "StringInstrument. h"
// TODO: Define mutator functions -
// SetNumOfStrings(), SetNumOfFrets()
// TODO: Define accessor functions -
// GetNumOfStrings(), GetNumOfFrets()

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:40
You begin your first day of responsibilities by examining the recent is security breach at gearup to get ideas for safeguards you will take. at gearup, criminals accessed the company's improperly-secured wireless system and stole customers' credit card information as well as employee social security numbers. what kind of computer crime did gearup face?
Answers: 3
question
Computers and Technology, 22.06.2019 16:00
You have inserted new slides based on a word outline. how do you format these new slides to match the powerpoint presentation formatting? a. select all slides in the presentation and click format on the home tab. b. select the new slides and click reset on the home tab. c. select all slides in the presentation and click reset on the home tab. d. select the new slides and click format on the home tab.
Answers: 3
question
Computers and Technology, 22.06.2019 19:30
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 1
question
Computers and Technology, 23.06.2019 04:40
The narrative structure of the popular movies can be broken down into
Answers: 3
You know the right answer?
Given main() and the Instrument class, define a derived class, StringInstrument, for string instrume...
Questions
question
Mathematics, 11.11.2019 22:31
question
Mathematics, 11.11.2019 22:31