Program whose input is number n and output is square of n

Assignment Help Basic Computer Science
Reference no: EM131313745

Implement the following algorithm to construct magic n-by-n2 squares; it works only if n is odd. Place a 1 in the middle of the bottom row. After k has been placed in the (i, j) square, place k + 1 into the square to the right and down, wrapping around the borders. However, if the square to the right and down has already been filled, or if you are in the lower-right corner, then you must move to the square straight up instead. Here is the 5 × 5 square that you get if you follow this method:

2005_matrix.png

Write a program whose input is the number n and whose output is the magic square of order n if n is odd. Implement a class MagicSquare with a constructor that constructs the square and a toString method that returns a representation of the square.

Reference no: EM131313745

Questions Cloud

How would you describe the personal style and preferences : Please pay special attention to the personal styles and preferences between the two target groups. How would you describe the personal style and preferences of the negotiators in the Far-East vs. the Westerners?
Why characteristics are important to your personal image : Support your response and include why you think the characteristics are important to your personal image
Assist in the installation of equipment : The engineering director of the company is called on to send one engineer abroad to assist in the installation of equipment. There are three qualified candidates, each working for a different manager under the director.
Find the pressure rise and efficiency as a function : Find the pressure rise and efficiency as a function of the flow rate per unit depth.- Determine the velocity profile in a fluid situated between two coaxial rotating cylinders.
Program whose input is number n and output is square of n : Write a program whose input is the number n and whose output is the magic square of order n if n is odd. Implement a class MagicSquare with a constructor that constructs the square and a toString method that returns a representation of the square.
Do you agree with the results of your assessment : Do you agree with the results of your assessment? Based on the results of your assessment, what do you see as your strengths and weaknesses? How might your personality type influence your job performance?
Consider the pedigree analysis of sickle-cell disorder : Consider the pedigree analysis of sickle-cell disorder. Based on four generations of data, does the inheritance of this disease appear to be related to the sex of the offspring?Consider the pedigree analysis of sickle-cell disorder. Do both males..
Describe the stages of team development : This question pertains to the movie Office Space (1999). Describe the stages of team development (Forming, Norming, Storming, Performing) when Michael, Samir, and Peter decide to work together to embezzle money from Initech. The answer to this que..
Describe what makes someone a professional in your field : Describe what makes someone a professional in your field. Use research and/or reflect on your personal experiences and what you know about your profession (or the profession you will work in)

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Executive summary on the enterprise

Executive Summary on the enterprise need in succinct terms, and on what has actually been done in your assignment and to what extent. It must be concise and right to the point.

  Complement in tcp and udp connections

UDP and TCP use the 1s complement for their check sums. Suppose you have the following three 8-bit bytes: 10011001, 01010010, and 01011001.

  Upper bound on message transmission times

There does not exit any protocol for two processes to reach common knowledge about a binary value in a reliable asynchronous message-passing system without an upper bound on message transmission times.

  How does sound waves travel to analyze

How does sound waves travel to analyze

  Create an array of ten doubles

Java program that reads temperature data from the user and displays statistical data about those temperature. Create an array of ten doubles. How do you even start this? This is a basic java course.

  The conversion must be done in a function

The conversion must be done in a function. The function will accept the pressure in bars and return both atmospheres and psi. Your script should continue to prompt the user to see if they wish to another calculation.

  Design a database schema for the proposed database design

Focus on one or two areas of your design that seemed especially difficult to develop and provide a brief assessment of the difficulty you encountered in modeling or mapping to the schema. In addition, provide the rationale for the design chosen, i..

  Why is an e-mail use policy important

1). Why is the issue of trust an integral part of a security policy 2). Why is an e-mail use policy important?

  Write a method, insertat, that takes four parameters

write a method, insertAt, that takes four parameters: an array of integers; the length of the array; an integer, say insertItem; and an interger, say, index.

  Amendment protection against unreasonable search

The 4th Amendment protection against unreasonable search and seizure has been jealously guarded for over 200 years. Consequently, all Americans are entitled to a reasonable expectation of privacy. How would you describe this standard, this so-call..

  What conditions must be fulfilled by a data set

What conditions must be fulfilled by a data set to allow it to be used as a teaching set for a neural network?

  Creates a series of random 2d objects

Part 1: Create a program (OpenGL, or DirectX) that creates a series of random 2D objects, (or 3D objects that only move in 2D), about 25 is probably good but you may need more or less and has them move around on the screen, they should wrap around..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd