please tell how to implement this program in java
Q2.Magic Squares.An n*n matrix that is filled with the numbers 1,2,...,n*n is a
magic square if the sum of the elements in each row ,in each column,and in the
two diagonals is the same value . For example
16 3 2 13
5 10 11 8
9 6 7 12
4 15 14 1
Write a program that reads in n*n values from the keyboard and tests whether
they form a magic square when put into array form.You need to test three
features:
->Did the user enter n*n numbers for some n?
->Does each of the numbers 1,2...,n*n occur exactly once in the user input?
->When the no.s are put into a square , r the sums of the rows , columns and
diagonals equal to each other?
If the size of the input is a square,test whether all no.s between 1 and n are
present.Then compute the row , column, and diagonal sums.
Q2.Magic Squares.An n*n matrix that is filled with the numbers 1,2,...,n*n is a
magic square if the sum of the elements in each row ,in each column,and in the
two diagonals is the same value . For example
16 3 2 13
5 10 11 8
9 6 7 12
4 15 14 1
Write a program that reads in n*n values from the keyboard and tests whether
they form a magic square when put into array form.You need to test three
features:
->Did the user enter n*n numbers for some n?
->Does each of the numbers 1,2...,n*n occur exactly once in the user input?
->When the no.s are put into a square , r the sums of the rows , columns and
diagonals equal to each other?
If the size of the input is a square,test whether all no.s between 1 and n are
present.Then compute the row , column, and diagonal sums.