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 17:00
Your company has 1,500 desktop computers running windows 7. you want to upgrade them to windows 10. which type of microsoft license would be best suited in this situation?
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
This question involves a class named textfile that represents a text file. public class textfile { private string filename; private string filename; private arraylist words; // constructors not shown // postcondition: returns the number of bytes in this file public int filesize() { } // precondition: 0 < = index < words.size() // postcondition: removes numwords words from the words arraylist beginning at // index. public void deletewords(int index, int numwords) { } // precondition: 0 < = index < = words.size() // postcondition: adds elements from newwords array to words arraylist beginning // at index. pub lic voidaddwords(int index, string[] newwords) { } // other methods not shown } complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte. for example, suppose the words arraylist stores the following words: { mary had a little lamb; its fleece was white as snow. } the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words. complete the filesize() method below: // postcondition: returns the number of bytes in this file public int filesize() { }
Answers: 1
question
Computers and Technology, 24.06.2019 07:30
Jason is working on a microsoft excel worksheet and he wants to create a print preview shortcut. his teacher asks him to access the customization option to create the new shortcut. which two tabs should jason select to place the print preview shortcut on the worksheet toolbar? a. new tab (custom) and new group (custom) b. new file tab (custom) and new tab (custom) c. new custom group and new command d. new custom tab and new command
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
question
Law, 08.04.2021 18:20
question
Mathematics, 08.04.2021 18:20
question
Mathematics, 08.04.2021 18:20