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, 23.06.2019 09:30
Which of the following tasks is an audio technician most likely to perform while working on a nature documentary? (select all that apply). eliminating potentially distracting background noise adding sound effects making sure the lighting is adequate for a particular scene changing the narration to better match the mood of the documentary
Answers: 3
question
Computers and Technology, 23.06.2019 10:30
How would you categorize the software that runs on mobile devices? break down these apps into at least three basic categories and give an example of each.
Answers: 1
question
Computers and Technology, 24.06.2019 03:30
Other - a written response, no less than arial 12-point font, to the following: of the following, which would you consider is most important to customer service goals? choose one and explain why. (1) accuracy (2) punctuality and attendance (3) courtesy (4) productivity (5) organization
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
What are the different components of the cloud architecture?
Answers: 2
You know the right answer?
Given main() and the Instrument class, define a derived class, StringInstrument, for string instrume...
Questions
question
Mathematics, 28.01.2020 19:03
question
Mathematics, 28.01.2020 19:03
question
Mathematics, 28.01.2020 19:04
Questions on the website: 13722361