Question: Part B [15 points]: This assignment extends from Part A that you have implemented previously. Recall that in Part A, a grid is drawn for

 Part B [15 points]: This assignment extends from Part A that
you have implemented previously. Recall that in Part A, a grid is

Part B [15 points]: This assignment extends from Part A that you have implemented previously. Recall that in Part A, a grid is drawn for filling in a 4 x 4 square of cells containing integers. For this part of the assignment, first you will need to implement a method that verifies whether a given 4 x 4 square (containing 16 values) is a Magic Square. A Magic Square for the purpose of this assignment is that the values in any horizontal row, vertical column or main diagonals add up to the same value. You will be using 2-dimensional arrays for storing and processing the values stored in a square. Here is the header for the above method: 1 * * This method verifies whether a given square is a magic square or not parameter squareData is a symmetrical 2 - dimensional array of integers * returns true if the square is magic if all rows or columns , or two main diagonals add up to same value * return false otherwise private static boolean isSquareMagic (int squareData ) ; Notes : 1. Implement the above method in the same class from Part A ( MagicSquare .java ) 2. Once implemented , test this method with squares that are both magic and otherwise . In other words, call this method from the main method in class MagicSquare .java 3. For testing, you need data. For a valid Magic Square, use the data from the grid below: CSC 142 Magic Square 4. For example, here is how the values in the above grid can be stored in using a 2-dimensional array: int squareData = {{8, 11, 14, 1 }, {13,2,7, 12 }, {3, 16,9,6 }, ( 10,5, 4, 15 }}

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 Physics Questions!