Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Java program that does which of the following: 1. Ask the user for the dimensions of a 2D Arrays. Requires 2 integers for
Write a Java program that does which of the following:
1. Ask the user for the dimensions of a 2D Arrays. Requires 2 integers for rows and columns. Minimum should be 5, maximum should be 10.
2. The Dimension cannot be negative. Using proper error checking with loops.
To generate a 2D array and populate it with random integers from 100 to 999 inclusive
3. Once the array has been created display the following results:
- Display the array in table format. (Print the 2D array). Make sure to print it with all the rows and columns neatly aligned.
- To calculate and display the sum and average of the entire array.
- Determine how many concentric rings the table contains and print that out the number.
- Print out the contents of just the outside ring on a separate line.
- The elements should be ordered from the top right corner of the outside ring going counter-clockwise.
- Print out how many elements are in the outside ring.
- Calculate and display the sum and average of the outside ring.
Sample output:
Enter an integer between 5 and 10 inclusive for number of Columns: 7 Enter an integer between 5 and 10 inclusive for number of Rows: 5 Generating random int array with 7 columns and 5 rows 578 423 258 717 696 382 303 834 453 765 941 558 705 627 665 165 875 282 703 966 998 624 898 387 872 468 919 553 563 228 855 988 677 602 622 The number of rings in the array = 3 Sum of all array elements = 22150 Average of all array elements = 632.8571 Number of elements in outer ring = 20 Outer ring elements listed going counter-clockwise: 303 382 696 717 258 423 578 834 665 624 563 228 855 988 677 602 622 553 998 627 Sum of outer ring elements 12193 Average of outer ring elements 609.65
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started