### (Solved) : Use Following Uml Diagram Define Class Called Point Rectangle Rectangle Aggregated 4 Point Q35620508

Use the following UML diagram to define a class called Point andRectangle, where a Rectangle is aggregated from 4 Point objects. APoint has an x and y coordinate and a Rectangle has 4 Points thatrepresent the upper left, upper right, lower left and lowerright.

Notes

- To determine if one Point is higher than other, compare the yvalues
- To determine if one Point is further than other, compare the xvalues
- A Rectangle contains a Points if the point lies inside theRectangle (not on the edges)
- A Rectangle contains a Rectangle if the other Rectangle fitsinside this Rectangle (with no Points on the edges) (seebelow).
- A Rectangle overlaps another Rectangle if one or two points ofone Rectangle are contained in another Rectangle (see below).
- A Rectangle crosses another Rectangle if two Rectangles overlapon 2 edges but do not contain any Points inside (see below).

Details

Now create a RectangleDemo to create and use Rectangle objects.Use a Scanner object to read the attributes for four Rectangleobjects (4 Points per Rectangle).

In the demo:

• Print the four Rectangles (using the toString method).

• Print the width, height and area of the first Rectangle.

• Print if the first Rectangle object is higher than the secondRectangle object

• Print if the first Rectangle object contains the second Rectangleobject

• Print if the second Rectangle object contains the third Rectangleobject

• Print if the first and third Rectangle cross over eachother

• Print if the first Rectangle overlaps the second Rectangle

• Print if the forth Rectangle overlaps the first Rectangle

Input

4 points per 4 Rectangles (2 * 4 * 4 numbers)**Sample Input:** 2 7 2 2 8 7 8 2 4 6 4 4 6 6 6 4 3 83 1 5 8 5 1 6 3 6 1 10 3 10 1

Output

**Sample Output:**

Rectangle:

(2, 7) (8, 7)

(2, 2) (8, 2)

Rectangle:

(4, 6) (6, 6)

(4, 4) (6, 4)

Rectangle:

(3, 8) (5, 8)

(3, 1) (5, 1)

Rectangle:

(6, 3) (10, 3)

(6, 1) (10, 1)

R1 width: 6

R1 height: 5

R1 area: 30

r1 is higher than r2 is true

r1 contains r2 is true

r2 contains r3 is false

r1 and r3 cross is true

r1 overlaps r2 is false

r4 overlaps r1 is true