solution

Write a class Square, generated by four points A, B, C, D, each with a (x,y) coordinates coordinates Ax, Ay, Bx, By, Cx, Cy, Dx, Dy. 
Implement the class such that we can generate instances using the following format:
S = Square(Ax, Ay, Bx, By, Cx, Cy, Dx, Dy) 
In addition write class member functions (methods)
area(), computes the area of the square. 
perimeter(), computes the perimeter of the square
center_of_square(), computes the xy-coordinate location of the center of the square 
shift(a,b), which shifts the instance of the square 'a' units in x direction, and 'b' units in y direction.
larger(), given two instances R1 and R2 of the class, the method larger returns the instance with the larger area, i.e. R1.larger(R2) 
Write a mlass member function show() which prints/produces the following output on screen:
"Square with corners at (Ax, Ay), (Bx, By), (Cx, Cy), (Dx, Dy), where Ax, Ay, Bx, By, etc. have been replaced with values that generated that instance to begin with.

 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
Looking for a Similar Assignment? Our Experts can help. Use the coupon code SAVE30 to get your first order at 30% off!

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp