Question: Do task 1 and task 2 in java Eclipse Task 1 Create a static method borderSum that accepts a 2D Square integer array of any
Do task 1 and task 2 in java Eclipse
Task 1
Create a static method borderSum that accepts a 2D Square integer array of any length and returns the sum of columns and rows as shown below. 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 2
Create a static method findCommon that accepts any two 2D Square integer arrays of the same length and returns a 1D integer array that contains the numbers that are common to both arrays. You must use an enhanced for loop and all checks must be performed inside the loop. You may create and use any helper methods inside this method.

this is how task 1 and task 2 should look like when making code

2 3 4. O 1 2 1 0 2 0 2 1 2 1. 2 3 = 40 1 2 3 1 4 6 7 2 3 1 8 9 2 7 3 5 4 = 34 5 6 2 3 8 2 7 8 9 3 1 2 5 4 1 1 3 0 1. 2 3 0 1 1 0 1 2 N N 1 5 1 3 0 1 2 3 2 6 8 1 2 1. 4 5 6 3 1 7 7 8 0 2 7 8 9 0 1 2 3 4 = 012 0 1 8 0 0 0 2 4 6 7 1 2 3 a 0 1 0 1 4 4 4 O 11 2 13 1 1 1 1 1 4 15 6 2 Oo oo 9 9 2 7 18 9 a a 3 a 9 //TASK 1 int[][] A = {{1,2,3},{4,5,6},{7,8,9}}; int[][] B = {{1,2,3,1,1},{4,6,7,2,2},{3,1,8,9,3}, {2,7,3,5,1},{5,1,1,1,3}}} System.out.println(borderSum(A)); System.out.println(borderSum(A)); //TASK 2 int[][] C = {{1,2,3},{4,5,6},{7,8,9}}; int[][] D = {{11,2,13},{4,15,6},{7,18,9}}; int[][] E = {{1,1,3,2},{5,1,3,2},{6,8,1,2},{1,7,8,0}}; int[][] F = {{1,4,4,4},{8,1,1,1},{9,9,9,9},{0,9,9,9}}; This display1DArray (findCommon (C,D)); you display1DArray (findCommon (E,F))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
