Magic Square

The Square class works with an n × n matrix of integers, numbers 1, 2, 3, ..., n^2 and identifies whether or not the matrix is a "magic square."

A square is magic if the sum of the elements in each row, in each column, and in the two diagonals is the same value.

Consider this matrix of values, for example. The sum of each column, each row, and each diagonal is 34.

16   3   2  13

 5  10  11   8

 9   6   7  12

 4  15  14   1

Your MagicSquare class will need to test three features:

If the size of the input is a square, test whether all numbers between 1 and n^2 are present. Then compute the row, column, and diagonal sums.

The Square class you implement will have:

You may wish to write additional "helper" methods if they would be useful in identifying if a square is magic.