Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help writing this simple code for java. Write a program that creates and manipulates two-dimensional arrays, according to the following specifications (refer to

I need help writing this simple code for java.

Write a program that creates and manipulates two-dimensional arrays, according to the following specifications (refer to the notes, ARRAYS_C, as needed):

Write a static method with no return value called print2DArray, which takes an array of type int[][] as a parameter. The method should print the array to the screen one row per line, starting with row 0, with one space between elements. The method should work for any size array (see your notes for hints).

You should test your print2DArray method by creating a couple of 2D arrays of different sizes (default 0 values are fine), calling your method, and making sure the output is the appropriate grid of values (zeroes for now, to keep it simple).

After youve tested and verified your print2DArray method, write code in your main method to accomplish the following tasks: 1. Create a new 2D array with 5 rows and 10 columns. 2. Populate the array with random 2-digit integers. 3. Print the array using your print2DArray method. 4. Now, change the four corner elements of your array to zeroes (see Sample Output). 5. Print the array again.

image text in transcribed

Sample Output Output-Lab6F18 (run) X Original array 75 78 77 87 94 97 45 49 20 37 59 27 33 97 43 10 14 6l 11 88 21 3 9 78 91 13 33 11 12 12 89 58 87 29 97 33 64 72 27 79 95 24 67 54 70 63 30 97 70 95 5 1 2 Modified version 0 78 77 87 94 97 45 49 20 0 59 27 33 97 43 10 14 l 11 88 21 3 9 78 91 13 33 11 12 12 89 58 87 29 97 33 E4 72 27 79 0 24 67 54 70 63 30 97 70 0 BUILD SUCCESSEUL (total time: 0 seconds) 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions