Question: Problem 1 ( 5 Points ) Create a class named RowsAndColumns in the file RowsAndColumns.java. The first problem involves writing two methods. One will sum

Problem 1(5 Points) Create a class named RowsAndColumns in the file RowsAndColumns.java. The first problem involves writing two methods. One will sum each row of a 2 dimensional array. It will return a single dimension array of ints holding the sums from each row. The prototype is: public static int[] sumRows(int[][] inArray) The next method you will write is one that will take a 2 dimensional array and sum each column. The prototype is: public static int[] sumColumns(int[][] inArray) Write a main to test both of these methods. As one test, use the following 2D array as input: int[][] inputMatrix ={{10,15,-1,22,11},{100,200,150,-30,27},{11,44,2,1,-15},{44,89,10,21,-2},{44,55,105,205,305}}; You should create a couple of additional 2 dimensional arrays of different sizes to verify your code works regardless of size (for instance, create an array that is not square like the above one so it will have a different number of rows than it has columns). Write some code in your main that prints the results returned on one entry per line. With the above array as input, the results should look like the following: Row Sums: 5744743162714 Column Sums: 209403266219326

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 Programming Questions!