Question: Develop a program that prints out the sum of each column of a two-dimensional array. The program defines method sumColumn() takes a two-dimensional array
Develop a program that prints out the sum of each column of a two-dimensional array. The program defines method sumColumn() takes a two-dimensional array of integers and returns a single-dimensional array that stores the sum of columns of the passed array. The program main method prompts the user to enter a 3-by-4 array, prints out the array, and then calls method sumColumns(). Finally, it prints out the array retuned by method sumColumns(). Document your code, and organize and space the outputs properly as shown below. C++ students: instead of asking the user for input, you must read it from a file. See appendix for more information. Sample run 1: Enter a value: 9. Enter a value: 1 Enter a value: 2 Enter a value: 4 Enter a value: 3. The entered matrix: 923 9 2 3 123 2 8 3 3 403 Sum of column 0 is 14 Sum of column 1 is 6 Sum of column 2 is 13 Sum of column 3 is 7. Sample run 2: [SIMILAR FORMAT OF INPUT ABOVE, BUT DIFFERENT NUMBERS] The entered matrix: 10 10 10 10 1 1 1 1 50 50 50 50
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
