Answered step by step
Verified Expert Solution
Question
1 Approved Answer
From the Wikipedia site (http://en.wikipedia.org/wiki/Magic square): In recreational mathematics, a magic square is an arrangement of numbers (usually integers) in a square grid, where the
From the Wikipedia site (http://en.wikipedia.org/wiki/Magic square): In recreational mathematics, a magic square is an arrangement of numbers (usually integers) in a square grid, where the numbers in each row, and in each column, and the numbers that run diagonally in both directions, all add up to the same number. A notation, "n" stands for the number of rows (and columns) it has. Thus, a magic square always contains n2 numbers, and its size (the number of rows [and columns] it has) is described as being "of order n". A magic square that contains the integers from 1 to n' is called a normal magic square. magic square has the same number of rows as it has columns, and in conventional math 27 615 95115 4 3 8-15 15 15 15 15 15 The constant that is the sum of every row, column and diagonal is called the magic constant or magic sum, M. Every normal magic square has a unique constant determined solely by the value of n, which can be calculated using this formula In this assignment, you are to write a program that takes a 2-dimensional array of ints as input and determines if it is in fact a normal magic square You will need to implement each of the following methods: public static int magicSum(int[J[ array) public static boolean public static boolean. public static boolean public static boolean isMagicSquare(int] array) public static boolean. public static int public static int public static int getSumOtow(int l array, int index) public static in getColumn(int[][] array, int index) public static int getSumQfColumn(intl] array) int] array) array int)l] array) (int)l] array) intljl] array) intll] array) You should test your program using a variety of 2-dimensional arrays. From the Wikipedia site (http://en.wikipedia.org/wiki/Magic square): In recreational mathematics, a magic square is an arrangement of numbers (usually integers) in a square grid, where the numbers in each row, and in each column, and the numbers that run diagonally in both directions, all add up to the same number. A notation, "n" stands for the number of rows (and columns) it has. Thus, a magic square always contains n2 numbers, and its size (the number of rows [and columns] it has) is described as being "of order n". A magic square that contains the integers from 1 to n' is called a normal magic square. magic square has the same number of rows as it has columns, and in conventional math 27 615 95115 4 3 8-15 15 15 15 15 15 The constant that is the sum of every row, column and diagonal is called the magic constant or magic sum, M. Every normal magic square has a unique constant determined solely by the value of n, which can be calculated using this formula In this assignment, you are to write a program that takes a 2-dimensional array of ints as input and determines if it is in fact a normal magic square You will need to implement each of the following methods: public static int magicSum(int[J[ array) public static boolean public static boolean. public static boolean public static boolean isMagicSquare(int] array) public static boolean. public static int public static int public static int getSumOtow(int l array, int index) public static in getColumn(int[][] array, int index) public static int getSumQfColumn(intl] array) int] array) array int)l] array) (int)l] array) intljl] array) intll] array) You should test your program using a variety of 2-dimensional arrays
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started