Question: Given main() and the Instrument class, write a .equals() method. Ex. If the input is: Drums Zildjian 2015 2500 Guitar Gibson 2002 1200 the output




Given main() and the Instrument class, write a .equals() method. Ex. If the input is: Drums Zildjian 2015 2500 Guitar Gibson 2002 1200 the output is First: Instrument Information: Name: Drums Manufacturer: Zildjian Year built: 2015 Cost: 2500 Copy: Instrument Information: Namo getManufacturer Ol return instrument Manufacturer; } public void setYearBuilt(int userYearBuilt) { yearBuilt = userYear Built; 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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: "); private int numStrings; private int numFrets; 50 51 52 53 54 55 56 57 58 59 60 61 public void setNumofStrings (int numStrings) { this.numStrings = numStrings; } public void setNumOffrets(int numFrets) { this.numFrets = numFrets; 3 62 63 64 65 66 67 68 69 public int getNumOfStrings() { return numStrings; } public int getNumoffrets(){ return numFrets; } System.out.println(getNumOfStrings.equals(getNumOffrets)); 70 Current file: Instrument.java DU public void setCost(int userCost) { cost = userCost; } public int getCost() { return cost; } 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 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); } // Add the .equals() method override for Object private int numStrings; private int numFrets
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
