Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Goal : The lab was designed to help you review classes, objects, files, arrays, and matrices. Lab Description : Write a program to make

Lab Goal : The lab was designed to help you review classes, objects, files, arrays, and matrices.
Lab Description : Write a program to make a magic square of numbers. A magic square is matrix of
numbers. Every column, every row, and every diagonal add up to the same value. Read in matrix values and
determine if the sum of all rows, columns, and diagonals is the same. If all have the same sum, print out that
the matrix is a magic square. Otherwise, print that the matrix is not a magic square.
Sample Input :
6
3
816357492
3
618753294
3
831357942
4
71211421381116310596154
5
17241815235714164613202210121921311182529
5
17241852357146461320210121921311182529
Sample Output :
816
357
492
MAGIC SQUARE
618
753
294
MAGIC SQUARE
831
357
942
NOT A MAGIC SQUARE
712114
213811
163105
96154
MAGIC SQUARE
17241815
23571416
46132022
101219213
11182529
MAGIC SQUARE
1724185
2357146
4613202
101219213
11182529
NOT A MAGIC SQUARE
15151515
81615
35715
49215
Files Needed ::
MagicSquare1.java
MagicSquare1Runner.java
magic1.dat
A+ Computer Science MAGIC SQUARE I

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions