Please help me to solve these two problems... 2D array: Complete 3 methods in this Java template Array2D template.java Method 1: create a 2D array with randomly initialized integer numbers of 0-20 Method 2: print the 2D array Method 3: find out which row has the largest sum and print out the row # and the largest sum
Please help me to solve these two problems...
- 2D array: Complete 3 methods in this Java template Array2D template.java
-
- Method 1: create a 2D array with randomly initialized integer numbers of 0-20
- Method 2: print the 2D array
- Method 3: find out which row has the largest sum and print out the row # and the largest sum
2. Write a program to make an array so that the size of the array is specified by the first command-line argument. If no command-line argument is supplied, use 10 as the default size of the array. Print all elements of the array.
-Here is the java code-
public class ArrayLab
{
public static void main( String[] args )
{
int a= , b= ;
// Do not change main method!
int[][] arr=createArray(a,b) ;
printArray(arr);
largestRow(arr);
} // end main
// method 1: create a 2D array with 2 int parameters, one for rows, one for
columns
public static ________ createArray(__________){
// method body here...
}
// method 2: print 2D array with one parameter which is a 2D array
public static _______ printArray(_________){
// method body here...
}
// method 3: find out which row has the largest sum and print out the row #
and the largest sum#
// with a 2D array as parameter
public static ___________ largestRow(____________){
// method body here...
}
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images