Question: 8. Ann x n matrix that is filled with the numbers 1,2,3, ....n2 is a magic square if the sum of the elements in each

 8. Ann x n matrix that is filled with the numbers
1,2,3, ....n2 is a magic square if the sum of the elements

8. Ann x n matrix that is filled with the numbers 1,2,3, ....n2 is a magic square if the sum of the elements in each row, in each column, and in the two main diagonals is the same value. For example, 16 3 213 5 10 11 8 9 6 7 12 4 15 14 1 Write the program that reads in 16 values from the keyboard and tests whether they form a magic square when put into a 4 x 4 array. Place the numbers in the matrix from top to bottonm left to right (i.e. the first number goes in the top left position and the last goes in the bottom right position) Write a method public static Boolean sameSet(int[] a, int[] b) that checks whether two arrays have the same elements in some order, ignoring duplicates. For example, the two arrays (1, 4, 9, 16, 9, 7, 4, 9, 11) and (11, 11,7, 9, 16, 4, 1) would be considered identical. Test your program using 2 different inputs. Submit a screenshot of the results 7

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!