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

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 22PE
icon
Related questions
Question

Please help me to solve these two problems...

  1. 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...
}
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT