APCS Java 2D Array Quiz 1. Write a method that returns the average
Transcription
APCS Java 2D Array Quiz 1. Write a method that returns the average
APCS Java 2D Array Quiz 1. Write a method that returns the average of the numbers in a given column c of a matrix. For example, suppose a 2 x 3 matrix contains 7 5 8 7 5 1 A call of columnAvg(mat, 1) would return 7.5 ( the average of the values in column 1, which are 8 and 7). public static double columnAvg(int[][] mat, int c) 2. Write a method findLargeNums that outputs the coordinates of every occurrence of a value in an integer matrix table which is greater than the sum of the four values in the matrix to its North, South, East and West. Output the coordinates for any such value in the form (ROW, COL) on a separate line for each occurrence. For example, in the matrix below, there are only two such numbers (shown in bold): 13 > (5 + 1 + 2 + 3) 7 > (2 + 1 + 2 + 1) 0 1 2 3 0 1 2 3 4 5 19 10 3 2 7 5 13 2 7 6 1 9 3 5 1 2 2 2 7 2 16 6 1 19 So the method would display the coordinates of these locations as: (2,1) (2,4) public static void findLargeNums (int[][] table)