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[]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f63337cef65_99966f63337520fd.jpg)
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
Get step-by-step solutions from verified subject matter experts
