using only java.util.scanner A magic square consists of a matrix of values organ
ID: 3711233 • Letter: U
Question
using only java.util.scanner
A magic square consists of a matrix of values organized into n rows and columns such that the sum of the values in the horizontal (row), vertical (columns) and diagonals are equal. For illustration purposes, the square below is "magic". Sum the vertical, horizontal and diagonal rows to verify:
Notes:
Input - The square will be initialized when it is declared. The source program below (PLP10171.java) shall serve as your "starter file". Review the code before developing the proof to determine if the square is indeed "magic". Build your proof in the area of the program bounded by the comments.
Processing - Develop the algorithm that can determine if the square is indeed magic.
Output -
Display the values in the square by column within row. Use the display above as a visual guide. Be sure to employ a display (print) method that will insure the values align vertically for easiest visual confirmation.
If the square meets the criteria for being magic, display the message "The square is Magic!". If the does not meet the criteria established, display the message "The square is not Magic!"
To test properly, modify the square so that it will fail the "magic" test.
Deliverables:
Submit the source code file (.java file) for Post Lab 09. The program should be named xxPLP10171.java, where xx are replaced by your two initials.
1 32 36 61 62 35 31 2 63 34 30 3 4 29 33 64Explanation / Answer
Hi Dear,
Please find my working code.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.