Question: Please use Java Problem 6. Rotate Matrix (Rotate.java) Description: Suppose you are given an n xn 2D matrix representing an image Rotate the image by

Please use Java
Please use Java Problem 6. Rotate Matrix (Rotate.java) Description: Suppose you are

Problem 6. Rotate Matrix (Rotate.java) Description: Suppose you are given an n xn 2D matrix representing an image Rotate the image by 90 degrees (clockwise). Example1: Given input matrix 1 (1,2,3). [4.561 17.8.9) 1 rotate the input matrix such that it becomes 17.4.1) (8,5,2). 19,6,3] 1 Example2: Given input matrix 15.1,9,11) [2,4,8,10), [13,3,6,7]. (15,14,12,161 1. rotate the input matrix such that it becomes: I [15,13,2,5). 114,3,4,1], 112,6,8,91. (16,7,10,111 1 Please include the following two methods in your class. 1) rotate(): has one parameter which is a 2D integer array, rotate that array and return that array. 2) main(): .create a 2D integer array which is a N'N matrix. N is a user entered number. The elements on this matrix are positive numbers entered by the user. -Display this 2D array Call the rotate() method to rotate the array Display the rotated array Hints: You do not have to create it in place. However, you can create another two-D array for the results. Outputs: As shown in the example

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!