Question: Problem 2: Write a Java class called ArrayTwoDim.java which calculates the sum of rows and columns of a 2D array (Matrix) and displays the 2D

Problem 2:

Write a Java class called ArrayTwoDim.java which calculates the sum of rows and columns of a 2D array (Matrix) and displays the 2D array.

The 2D array is already provided in Java class ArrayTwoDimTest.java , use this class to test the ArrayTwoDim.java.

Submit only the ArrayTwoDim.java file. We will use our own ArrayTwoDimTest to test your ArrayTwoDim class when grading your submission.

Input 2D array:

20 15 6 19 18

4 46 24 17 18

12 50 23 16 31

Sample Output:

The sum of row 1 = 78

The sum of row 2 = 109

The sum of row 3 = 132

The sum of column 1 = 36

The sum of column 2 = 111

The sum of column 3 = 53

The sum of column 4 = 52

The sum of column 5 = 67

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!