Java
MyRectangle # width : double # height: double #x : double // center of the rectangle is at (this.x, this.y) # y : double + MyRectangle() MyRectangel(double x, double y, double width, double height) +get, set methods for width and height get methods for x and y getArea): double //returns the area of the rectangle getPerimeter) : double //returns the perimeter of the rectangle getDiagonal() : double I/ returns the length of the diagonal of the rectangle isSquare): boolean //returns true if the rectangle is a square, Fig. 1 (e) moveTo(double x0, double yo): void//move the center of the rectangle to (x0, yo) ontains(double x0, double yo): boolean //returns true if (x0, y0) is inside the rectangle as in Fig 1 ontains(MyRectangle r): boolean //returns true, if rectangle r is contained in the rectangle Fig. 1 verlaps(MyRectangle r): boolean//returns true, if rectangle r is contained in the rectangle Fig. 1 isjoint(MyRectangle r): boolean //returns true, if rectangle r is disjoint with the rectangle Fig. 1 uals(MyRectangle r) : boolean //returns true if r has the same dimension with the rectangle. .1 (a) A point is inside the rectangle. (b) A rectangle is inside another rectangle. (c) A rectang erlaps another rectangle. (d) Two rectangles are disjoint. (e) A rectangle is a square. Implement MyRectangle class as described in the UML. Test it in main method: 1) Create a rectangle named rectA, with center (50, 50), width 80, and height 60 2) Create a rectangle named rectB, with center (60, 50), width 10, and height 10 3) Create rectangle named rectC, with center (120, 50), width 20, and height 10 4) Test if (25, 75) is contained by rectA. Display the result. 5) Test if rectB is contained in rectA. Display the result. 6) Test if rectA is a square. Display the result. 7) Display perimeter of rectA. Display the result. 8) Test if rectA and rectC are disjoint. Display the result. 9) Move rectA to (85, 50) mit zipned proiect. result txt (or errors tyt if it does not comnilel to D21 Assignment