Question: Task 3 Create a static method sumLeftRightDiagonals that accepts any two 2D Square integer arrays of the same length and returns a 1D array that

Task 3

Create a static method sumLeftRightDiagonals that accepts any two 2D Square integer arrays of the same length and returns a 1D array that contains the left diagonal from the first array and the right diagonal from the second array and the last index of the 1D array is the sum of the left and right diagonal values.

You must use an enhanced for loop and all calculations must be performed inside the loop.

You may create and use any helper methods inside this method.

Task 3 Create a static method sumLeftRightDiagonals that accepts any two 2D

This is how it should start

int[][]G={{1,2,3},{4,5,6},{7,8,9}};

int[][]H={{0,2,3},{4,5,6},{2,8,1}};

0 1. 2 0 1 2 3 1 1. 4 5 6 2 7 8 9 0 1. 2 3 4. 5 6 = 0 1 5 9 3 5 2 25 0 1 2 0 0 2 3 1 4 5 6 SUM 2 2 18 1 01. 12 0 0 Maximum Value in Block 2 Minimum Value in Block 0 1. 6 2 Average Value in Block 3 5 2 3 2 4 0 1. 2 4 6 8 0 6 4.5 6 5 11 12 0 1 2 0 1 2 3 1. 2 3 4 5 6 7 8 = 183 1 4 6 0 5 8 12 17 23 30 38 47 LO 00 2 7 9 0 1. 0 1. 3 0 1 = = 31 0 3 5 9 14 1 4 //TASK 3 int[][] G = {{1,2,3},{4,5,6}, {7,8,9}}}| int[][] H = {{0,2,3},{4,5,6}, {2,8,1}}; display1DArray (sumLeftRightDiagonals (GH)); //TASK 4 int[][] ) = {{1,2}, {2,6},{3,5}, {2,4},{6,8},{11,12}}; display1DArray (blockStats (J)); //TASK 5 int[][] K = {{1,2,3},{4,5,6},{7,8,9}}; int[][] L = {{1,2}, {4,5}}; System.out.println((pseudoFibonacci(K))); System.out.println((pseudoFibonacci(L))); } 0 1. 2 0 1 2 3 1 1. 4 5 6 2 7 8 9 0 1. 2 3 4. 5 6 = 0 1 5 9 3 5 2 25 0 1 2 0 0 2 3 1 4 5 6 SUM 2 2 18 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!