Question
Need help ASAP. Please write the code in Java language. following the requirements detailed in the question. Also please include the main method. and format
Need help ASAP. Please write the code in Java language. following the requirements detailed in the question. Also please include the main method. and format the program in a relatively neat manner with indents. If possible include a screenshot of the output. Thanks.(P.S I will be using repl.it to modify and see the code works as well, for compatibility and to check it works) In addition I would like to see the professor requires that we show an example hardcoded into the solution i.e. 1) an example of a normal magic sqaure 2) example of a magic square that is not normal and 3) an example of a non magic sqaure. I do need assistance ASAP in solving the problem as I cannot understand where to even start. Thanks!!
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 magic square has the same number of rows as it has columns, and in conventional math 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 n2 is called a normal magic square 27615 95 115 43815 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 l 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[] array) public static boolean rowsAreAllEqualToMagicSum(int]] array) public static boolean columnsAreAllEqualToMagicSum(int array) public static boolean diagonalsAreBothEqualToMagicSum(int array) public static boolean isMagicSquare(int array) public static boolean isNormalMagicSquare(int00 array) public static int getSumOfDownDiagonal(int] array) public static int getSumOfUpDiagonal(int[]] array) public static int getSumOfRow(int array, int index) public static int[ getColumn(intarray, int index) public static int getSumOfColumn(int[] array)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