Question: Write a program that randomly fills in 0-9 into an n times m matrix, prints matrix, and finds the rows and columns with the largest
Write a program that randomly fills in 0-9 into an n times m matrix, prints matrix, and finds the rows and columns with the largest value. You can use different approaches to solve this problem. For example, you can use two-dimensional arrays to store randomly generated data and ArrayList for saving the indices. Enter the number of rows 4 Enter the number of columns 6 The array content is: 7 0 2 7 9 4 1 3 6 8 1 5 0 4 4 9 4 8 5 6 3 2 2 0 The index of the largest row: 3 The index of the largest column: 4 Methods needed: public static void main(String[] args){} public static int sumRow(int row[]){} public static int sumcolumn(int matrix[][], int column) {} Write a program that randomly fills in 0-9 into an n times m matrix, prints matrix, and finds the rows and columns with the largest value. You can use different approaches to solve this problem. For example, you can use two-dimensional arrays to store randomly generated data and ArrayList for saving the indices. Enter the number of rows 4 Enter the number of columns 6 The array content is: 7 0 2 7 9 4 1 3 6 8 1 5 0 4 4 9 4 8 5 6 3 2 2 0 The index of the largest row: 3 The index of the largest column: 4 Methods needed: public static void main(String[] args){} public static int sumRow(int row[]){} public static int sumcolumn(int matrix[][], int column) {}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
