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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 18:00, kimmosley80
Which if the following allows you to view and access important information about your documents all in one location
Answers: 3
image
Computers and Technology, 22.06.2019 22:30, hmontalvo22
Who needs to approve a change before it is initiated? (select two.) -change board -client or end user -ceo -personnel manager -project manager
Answers: 1
image
Computers and Technology, 22.06.2019 22:50, youngboymark123
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
image
Computers and Technology, 23.06.2019 18:20, Blossom824
What is wi-fi infrastructure? a metropolitan area network that uses radio signals to transmit and receive data a communications technology aimed at providing high-speed wireless data over metropolitan area networks a means by which portable devices can connect wirelessly to a local area network, using access points that send and receive data via radio waves includes the inner workings of a wi-fi service or utility, including the signal transmitters, towers, or poles and additional equipment required to send out a wi-fi signal
Answers: 2
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 in other subjects:

Konu
History, 11.10.2020 05:01
Konu
Mathematics, 11.10.2020 05:01
Konu
Mathematics, 11.10.2020 05:01