Question: Write a class named MatrixSum with the following two methods and functionality: 1. Write a main method to prompt the user to enter a 3
Write a class named MatrixSum with the following two methods and functionality:
1. Write a main method to prompt the user to enter a 3 by 4 matrix row by row.
Have this method to reads and builds a multidimensional array which houses the 3 by 4 matrix
Have this method to call the sumColumn method to produce the column sum.
Have this method to display the sum of each column
2. Write a sumColumn method that returns the sum of all the elements in a specified column in a matrix using the following header:
public static double sumColumn( double[][] m, int columnIndex )
Heres a sample run:
Enter a 3 by 4 matrix row by row:
1.4 2 3 4 [ENTER]
5.5 6 7 8 [ENTER]
9.5 1 3 1 [ENTER]
Sum of the elements at column 0 is 16.4
Sum of the elements at column 1 is 9.0
Sum of the elements at column 2 is 13.0
Sum of the elements at column 3 is 13.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
