Alpha Geek

(8)

$10/per page/Negotiable

About Alpha Geek

Levels Tought:
University

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Environmental science,Essay writing,Programming,Social Science,Statistics Hide all
Teaching Since: Apr 2017
Last Sign in: 344 Weeks Ago, 6 Days Ago
Questions Answered: 9562
Tutorials Posted: 9559

Education

  • bachelor in business administration
    Polytechnic State University Sanluis
    Jan-2006 - Nov-2010

  • CPA
    Polytechnic State University
    Jan-2012 - Nov-2016

Experience

  • Professor
    Harvard Square Academy (HS2)
    Mar-2012 - Present

Category > Programming Posted 22 May 2017 My Price 8.00

Write a program that reads in n2 values from the keyboard and tests

 

Magic squares. An n × n matrix that is filled with the numbers 1, 2, 3, . . . , n2 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,

Write a program that reads in n2 values from the keyboard and tests whether they form a magic square when arranged as a square matrix.

You need to test three features:

• Did the user enter n2 numbers for some n?

• Do each of the numbers 1, 2, . . . , n2  occur exactly once in the user input?

• When the numbers are put into a square, are the sums of the rows, columns, and diagonals equal to each other?

If the size of the input is a square, test whether all numbers between 1 and n2 are present. Then compute the row, column, and diagonal sums. Implement a class Square with methods

 

 

 
 

Answers

(8)
Status NEW Posted 22 May 2017 03:05 PM My Price 8.00

-----------

Attachments

1495466164-2041312_3_636309632979865655_sample-output.PNG
file 1495466207-Answer.docx preview (919 words )
M-----------agi-----------c s-----------qua-----------res-----------. A-----------n n----------- ×----------- n -----------mat-----------rix----------- th-----------at -----------is -----------fil-----------led----------- wi-----------th -----------the----------- nu-----------mbe-----------rs -----------1, -----------2, -----------3, -----------. .----------- . -----------, n-----------2 -----------is -----------a m-----------agi-----------c s-----------qua-----------re -----------if -----------the----------- su-----------m o-----------f t-----------he -----------ele-----------men-----------ts -----------in -----------eac-----------h r-----------ow,----------- in----------- ea-----------ch -----------col-----------umn-----------, a-----------nd -----------in -----------the----------- tw-----------o d-----------iag-----------ona-----------ls -----------is -----------the----------- sa-----------me -----------val-----------ue.----------- Fo-----------r e-----------xam-----------ple-----------, ----------- W-----------rit-----------e a----------- pr-----------ogr-----------am -----------tha-----------t r-----------ead-----------s i-----------n n-----------2 -----------val-----------ues----------- fr-----------om -----------the----------- ke-----------ybo-----------ard----------- an-----------d t-----------est-----------s w-----------het-----------her----------- th-----------ey -----------for-----------m a----------- ma-----------gic----------- sq-----------uar-----------e w-----------hen----------- ar-----------ran-----------ged----------- as----------- a -----------squ-----------are----------- ma-----------tri-----------x. ----------- Yo-----------u n-----------eed----------- to----------- te-----------st -----------thr-----------ee -----------fea-----------tur-----------es:----------- â-----------€¢ -----------Did----------- th-----------e u-----------ser----------- en-----------ter----------- n2----------- n-----------umb-----------ers----------- fo-----------r s-----------ome-----------
Not Rated(0)