Java programing This week, it is time to wrangle two-dimensional arrays. Write t
ID: 3902032 • Letter: J
Question
Java programing
This week, it is time to wrangle two-dimensional arrays. Write the class TwoDeeArrayProblems with the following methods. As always, all these methods must be silent so that they print nothing on the console, but for your own debugging purposes during the development, note that the correct way to print out the contents of the two-dimensional array arr using only one line of code would be
System.out.println(java.util.Arrays.deepToString(arr));
1.double[] minValues(double[][] a) that creates and returns the one-dimensional array b whose length equals the number of rows in a. Each element b[i] should equal the smallest element in the i:th row of the parameter array a, or if that row is empty, equal 0.0. Unlike the previous question, in this problem you may not assume that every row has the same length.
2.int[][] zigzag(int rows, int cols, int start) that creates and returns a two-dimensional array of integers with the given number of rows and cols. This array should contain numbers ascending from start listed in order in the consecutive rows, except that every row whose row index is odd is filled in reverse order. For example, if rows is 3, cols is 5 and start is 14, this method would create and return a two-dimensional array with the elements
14 15 16 17 18
23 22 21 20 19
24 25 26 27 28
TEST
Explanation / Answer
Hi. please find the answer above.. i have given comments so that it is very easy for you to understand the flow. In case of any doubts, please ask in comments. If the answer helps you, please upvote. Thanks!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.