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 20:40
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it
Answers: 2
question
Computers and Technology, 23.06.2019 02:30
What is the power dissipated by a resistor with a current of 0.02 a and a resistance of 1,000 ? a. 200 w b. 20 w c. 0.4 w d. 4 w
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
You have been supporting csm tech publishing's windows server 2016 server network for over a year. the office has two windows server 2016 servers running active directory and a number of other roles. management has informed you that a small sales office is opening in the same building three floors up. the sales manager wants to install a sales application on a server located in the sales office. this server will have limited physical security because there's no special room dedicated for it, which means it will be accessible to non-it personnel and visitors. you're considering installing windows server 2016 server core on the new server because accessing its console regularly probably won't be necessary, and this server will be managed from one of the other csm tech publishing servers. what are the benefits and drawbacks of using server core for this branch office? what are some things you should do to set up this server management environment?
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
In which of the following ways can using test-taking tips you? a. you can focus on the information that you need to study. b. you will see the answers to the test. c. you will study more. d. you will be less organized.
Answers: 1
You know the right answer?
Instrument information (derived classes) Given main() and the Instrument class, define a derived cla...
Questions
question
Chemistry, 05.09.2020 03:01
Questions on the website: 13722367