subject

For the final exercise, we are going to create a 2D Array tester. We want our tester to be versatile, so the class has been designed to take any 2D Object. Polymorphism will allow us to pass any Object type in and do a comparision using that object’s .equal method. This can get a little tricky, so you are given a bit of the structure to help make this happen. You are also given a complete tester code that will compare 4 different arrays for you. The first two should be the same and return true, the second two are different and should return false. Your task is to complete the equals method. Two arrays are equal if all the elements are the same. As you develop your logic, be sure to consider the case when two arrays may be different sizes. public class TwoDTester { public static void main(String[] args) { Integer[][] firstArray = {{2,3}, {3,4}, {4,5}}; Integer[][] secondArray = {{2,3}, {3,4}, {4,5}}; TwoDArray first = new TwoDArray(firstArray); System. out. println(first. equals(secondArray)); String[][] thirdArray = {{"Hello", "Goodbye"}, {"Hola", "Adios"}, {"Bonjour", "Au revoir"}}; String[][] fourthArray = {{"Hello", "Goodbye"}, {"Ciao", "Addio"}, {"Bonjour", "Au revoir"}}; TwoDArray third = new TwoDArray(thirdArray); System. out. println(third. equals(fourthArray)); }}public class TwoDArray { private Object[][] myArray; public TwoDArray(Object[][] input){ myArray = input; } public boolean equals(Object[][] other){ // Add your code here }}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:00
What is added to the < meta > tag to describe the encoding type?
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Which of the following would you find on a network
Answers: 3
question
Computers and Technology, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
You know the right answer?
For the final exercise, we are going to create a 2D Array tester. We want our tester to be versatile...
Questions
question
English, 23.05.2020 02:02
question
Mathematics, 23.05.2020 02:02
Questions on the website: 13722360