Question: Suppose you have a square matrix, that is, a 2-dimensional array with the same number of rows and columns (up to a variable named SIZE).

Suppose you have a square matrix, that is, a 2-dimensional array with the same number of rows and columns (up to a variable named SIZE). Every square matrix has a diagonal. Write a Java program that uses a method to reverse the diagonal. Initialize the original matrix with random numbers between 1 and 50, print the original matrix, call the method to reverse the diagonal, and print the resulting matrix. (Use methods for all these operations). Write your program so that it will generate output similar to the sample output below in java: Do you want to start(Y/N): y Enter the size of the square matrix (up to 30): 4 The original matrix is: 46 44 12 41 33 23 17 30 50 28 26 29 44 14 48 20 The matrix after reversing the diagonal is: 20 44 12 41 33 26 17 30 50 28 23 29 44 14 48 46 Do you want to continue(Y/N): y Enter the size of the square matrix (up to 30): 3 The original matrix is: 20 34 22 10 37 2 42 4 1 The matrix after reversing the diagonal is: 1 34 22 10 37 2 42 4 20 Do you want to continue(Y/N): n

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!