subject

Instrument information (derived classes) Given main() and the Instrument class, define a derived class, String Instrument, for string instruments. Ex. If the input is: Drums Zildjian 2015 2500 Guitar Gibson 2002 1200 19 the output is: 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 File is marked as read only Current file: InstrumentInformation. java 1 import java. util. Scanner; public class Instrument Information { public static void main(String[] args) { Scanner scnr = new Scanner(System. in); Instrument my Instrument = new Instrument(); String Instrument myString Instrument = new StringInstrument(); String instrumentName, manufacturerName, string InstrumentName, stringManufacturer; int yearBuilt, cost, stringYearBuilt, stringCost, numStrings, numFrets; instrumentName = scnr. nextLine(); manufacturerName = scnr. nextLine(); yearBuilt = scnr. nextInt(); scnr. nextLine(); cost - scnr. nextInt(); scnr. nextLine(); stringInstrumentName = scnr. nextLine(); stringManufacturer = scnr. nextLine(); stringYearBuilt = scnr. nextInt(); stringCost = scnr. nextInt(); numStrings = scnr. nextInt(); numFrets = scnr. nextInt(); my Instrument. setName(instrumentName); my Instrument. setManufacturer (manufacturerName); my Instrument. setYearBuilt(yearBuilt); my Instrument. setCost(cost); my Instrument. printInfo(); myStringInstrument. setName(string InstrumentName); myString Instrument. setManufacturer(stringManufacturer) ; myString Instrument. setYearBuilt(stringYear Built); myString Instrument. setCost(stringCost); myString Instrument. setNumOfStrings (numStrings); myString Instrument. setNumOffrets(numFrets); myString Instrument. printInfo(); System. out. println(" System. out. println(" Number of strings: " + myString Instrument. getNumOfStrings()); Number of frets: " + myString Instrument. getNumOffrets()); 43 } File is marked as read only Current file: Instrument. java- public class Instrument { protected String instrumentName; protected String instrument Manufacturer; protected int yearBuilt, cost; public void setName(String userName) { instrumentName = userName; public String getName() { return instrumentName; public void setManufacturer(String userManufacturer) { instrumentManufacturer = userManufacturer; public String getManufacturer() { return instrumentManufacturer; public void setYear Built(int userYearBuilt) { yearBuilt = userYearBuilt; public int getYearBuilt() { return yearBuilt; public void setCost(int userCost) { cost = userCost; public int getCost() { return cost; public void printInfo() { System. out. println("Instrument Information: "); System. out. println(" Name: " + instrumentName); System. out. println(" Manufacturer: " + instrumentManufacturer); System. out. println(" Year built: " + yearBuilt); System. out. println(" Cost: " + cost); Current file: StringInstrument. java Load default template... 1 // TODO: Define a class: String Instrument that is derived from the Instrument class 2 public class String Instrument extends Instrument { // TODO: Declare private fields: numStrings, numFrets // TODO: Define mutator methods - // setNumOfStrings(), setNumOffrets() 9 // TODO: Define accessor methods - // getNumOfStrings(), getNumOffrets() 13

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:00
Which of the following has not been attributed at least in part to social media a. drug addiction b. depression c. kidnapping d. murder
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
Plz ( which is an example of a good url?
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
What is one reason why indoor air pollution has become an increasing problem.
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
To move a file or folder in microsoft windows, you can click and hold down the left mouse button while moving your mouse pointer to the location you want the file or folder to be, which is also known as.
Answers: 3
You know the right answer?
Instrument information (derived classes) Given main() and the Instrument class, define a derived cla...
Questions
question
Mathematics, 15.05.2021 06:10
question
Mathematics, 15.05.2021 06:10
question
Mathematics, 15.05.2021 06:10
question
English, 15.05.2021 06:10
question
Social Studies, 15.05.2021 06:10
question
Mathematics, 15.05.2021 06:10
Questions on the website: 13722359