Making a square 2 dimensional integer array
Making a square 2 dimensional integer array *
// ***********************************************
// You will:
// 1- ask the user for size of 2-dimensional array (you need to ask the user for number of rows) and create the array. It is a square array, so number of rows should be equal to the number of columns
// 2- fill the array with random integers from 1 to the size limit
// 3- print the array
// 4- prompt to see if the user wants to do another
// Production hints- USE THE TEMPLATE FILE!!!
// 1- Don't allow 0 size arrays.
// 2- You will need to use nested for loops to assign values to the elements of the array and to print them
// So that the values in the array aren't huge keep them limited to a range that is determined by the number of rows{ A 6x6 square will contain integers smaller than 7, a 3x3 square will have integers smaller than 4}
// 3- Print it in the square format (On screen it will look like a rectangle but as long as the number of rows and columns are the same we will consider it a square.
// 4- If you used a Do loop to start the square the While condition could be held here to check a sentinel
12 years ago
Purchase the answer to view it
- matrixprogram.java