Write a Square class, which represents a square on the2-dimensional x-y plane. A
ID: 3613329 • Letter: W
Question
Write a Square class, which represents a square on the2-dimensional x-y plane. Allsquares have a width (of each side) as well as a position on the2-dimensional x-y plane.
You may assume that the square’s sides must always beparallel to the x and y-axes.
Your class must have accessor methods for the following:
· The length of the side of the square
· The x coordinate of the center of the square
· The y coordinate of the center of the square
Your class must also have methods that allow you to determine(return) the following
(these should not be printed on the screen from inside thesemethods):
· The area of the square
· The perimeter of the square
· Whether a given point lies inside the square. This methodshould take 2
parameters, which are the x and y coordinates of the given point. Apoint that lies
on or outside of the boundary is not inside the square.
For your Square class, you must decide for yourself:
· Appropriate instance variables
· Appropriate method names, parameters and return types ofthe above methods, as
well as for the constructor
· What code to write in these methods and theconstructor
In a separate class, the SquareTester class, create Square objectsand perform basic
testing by using each of the methods that you wrote at least once,and printing out some
results to prove that they are working. There must be no printstatements inside the
Square class. Instead, all the printing should take place insidethe SquareTester class.