Computers and Technology
Computers and Technology, 28.07.2021 22:00, gobbler80

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 00:50, Cnolteb5663
Is one of the most injurious events that can happen to a person in a crash.
Answers: 1
image
Computers and Technology, 22.06.2019 14:30, qxchung7310
The โ€œrule of 72โ€ is used to approximate the time required for prices to double due to inflation. if the inflation rate is r%, then the rule of 72 estimates that prices will double in 72/r years. for instance, at an inflation rate of 6%, prices double in about 72/6 or 12 years. write a program to test the accuracy of this rule. for each interest rate from 1% to 20%, the program should display the rounded value of 72/r and the actual number of years required for prices to double at an r% inflation rate. (assume prices increase at the end of each year.)
Answers: 1
image
Computers and Technology, 22.06.2019 18:10, o10922025
Assume that to_the_power_of is a function that expects two int parameters and returns the value of the first parameter raised to the power of the second parameter. write a statement that calls to_the_power_of to compute the value of cube_side raised to the power of 3 and that associates this value with cube_volume.
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, HannahVance99
In the context of an internet connection, llc stands for leased line connection liability limited company local loop complex local loop carrier
Answers: 1
Do you know the correct answer?
Instrument information (derived classes) Given main() and the Instrument class, define a derived cla...

Questions in other subjects:

Konu
Mathematics, 11.02.2021 17:30
Konu
Mathematics, 11.02.2021 17:30