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, 21.06.2019 15:30
Some of the items below indicate the steps required to move a slide to a different location in a presentation. select those steps and indicate the order in which they should be performed to move the slide. (for example, if an item describes what you do first, select 1.) included in the list are items that are not part of the process. for these items, select n/a, an abbreviation for not applicable. 1 — first 2 — second 3 — third 4 — fourth 5 — fifth 6 — sixth n/a — not applicable drag the slide to the desired place. enter the slide position desired. hold the mouse button down. select move from the tools menu. select the slide. switch to the notes view.
Answers: 3
question
Computers and Technology, 22.06.2019 18:00
Write a method named addall that could be placed inside the hashintset class. this method accepts another hashintset as a parameter and adds all elements from that set into the current set, if they are not already present. for example, if a set s1 contains [1, 2, 3] and another set s2 contains [1, 7, 3, 9], the call of s1.addall(s2); would change s1 to store [1, 2, 3, 7, 9] in some order. you are allowed to call methods on your set and/or the other set. do not modify the set passed in. this method should run in o(n) time where n is the number of elements in the parameter set passed in.
Answers: 2
question
Computers and Technology, 23.06.2019 02:00
What is the main benefit of minimizing the ribbon in word? more options will be accessible through customized keystrokes. more of the document will be viewable without needing to scroll. fewer controls will be accessible to the user by using the mouse. fewer editing options will be available without entering a password.
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the can apple do to fix this issue?
Answers: 1
You know the right answer?
Given main() and the Instrument class, define a derived class, StringInstrument, for string instrume...
Questions
question
Mathematics, 29.01.2021 19:20
question
Mathematics, 29.01.2021 19:20
question
Mathematics, 29.01.2021 19:20
Questions on the website: 13722361