Question: Problem ALG004r Write a Class called Problem ALG004r to do the following: 1. Write out the Magic Square of any odd dimension n i.e. n

 Problem ALG004r Write a Class called Problem ALG004r to do the

Problem ALG004r Write a Class called Problem ALG004r to do the following: 1. Write out the Magic Square of any odd dimension n i.e. n is an odd number) A Magic Square has the following properties: a. The sum of all the rows are the same (assume this total is x) b. The sum of all the columns is also X C. The sum of the two diagonals is also X Example: A solution to a 3 X 3 Magic Square is: 1 6 8 3 4 5 9 7 2 The sum of each row, column and diagonal is 15. Your program should also accept another parameter (called rotation) that specifies the position of the starting 1 in the solution (it should be obvious that every 90 degree rotation of the magic square produces the same solution - except the starting 1 will be in a different position in each case). Thus, if rotation = 0, then the starting 1 is top middle (as per above)

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!