Question: 6 7 Main.java 8 class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print(Enter dimensions: ); 9 10 11 12

 6 7 Main.java 8 class Main { public static void main(String[]

6 7 Main.java 8 class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter dimensions: "); 9 10 11 12 // 1. scan ints for the number of rows and cols 1/ declare a 2D array of ints with these dimensions 13 14 15 16 17 18 19 20 // 2. iterate over the 2D array and // use the Math.random() method (with other arithmetic // and casts) to assign a random integer value // between 0 and 10 (inclusive) into each index 21 // 3. use a for-each loop to iterate over the // 2D array and System.out each value // the output should look like a 2D array (grid) // 4. find the sum of all the values in the array 22 23 24 25 26 27 28 29 30 scan.close(); 31 32 33 } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!