Question: Jagged Array Assignment Create a program that uses a Jagged Array. Remember a Jagged Array is nothing more than a 2D array with each row
Jagged Array Assignment
Create a program that uses a Jagged Array. Remember a Jagged Array is nothing more than a 2D array with each row having a different number of columns.
The program will create an array with 50 rows. You will randomly populate column index zero [the yellow cells in the example below) of the array with numbers between 1 and 20. The yellow cells are the only cells where you will insert a random number.
For each row, you will look at the random number that was placed in column index zero and then using this value create that many columns for that individual row in the Jagged Array.
For each row, you will start in that rows column index 1 and add one to the value in the column to the left. You will do this for the remaining columns for that row.
Below is an example of a jagged array table with random values placed in each rows index zero column and showing each of the other columns and values for that row.
| 3 | 4 | 5 | 6 | |||||||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 | ||||
| 5 | 6 | 7 | 8 | 9 | 10 | |||||
| 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 2 | 3 | 4 | ||||||||
| 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | |||
| 1 | 2 |
After you create and populate the entire array, you will output what you created. Finally, you will also output the following values, the sum of all values in the array and the average of all values in the array.
Remember everything possible needs to be written using methods. This should be a FUN little assignment.
Submission Requirement
Donot use GOTO or global variables.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
