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
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