Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java using eclipse Class name is Quadrilateral It has 4 private MyPoint object attributes, one for each corner of the quadrilateral (4 sided) shape.

in java using eclipse

Class name is Quadrilateral

It has 4 private MyPoint object attributes, one for each corner of the quadrilateral (4 sided) shape. If you want to you could use an array of MyPoints, it doesn't really matter because they are private.

Give it a no argument Constructor with default corner points (-1,1), (1,1), (1,-1), (-1,-1)

Include a Constructor that takes 4 MyPoint objects. Be aware that the Points may not be given is a usable order and the points will have to be adjusted as necessary.

Method named getArea() that returns the area.

Method named getPerimeter() that returns the total length of the perimeter.

Method named getCenter() that returns a MyPoint value for the center of the Quadrilateral object.

*hint on finding the intersection between two lines (make sure to include attribution to the source) https://tutorialspoint.dev/algorithm/geometric-algorithms/program-for-point-of-intersection-of-two-lines (Links to an external site.)

Method named getSides() that returns an array of doubles containing the length of each side in clockwise order, it does not matter which side is first..

Method named getCorners() that returns an array of MyPoints of the corner locations. the points will be in a order going clock wise (doesn't mater which corner is first). The order is not necessarily the same as was provided to the Constructor. make sure to deep copy the corner MyPoint objects before returning to make sure the Quadrilater Class is immutable and can not be changed using the returned MyPoint objects.

Method named contains(double x, double y) that takes a x and y doubles and returns if that location is inside the Quadrilateral.

Overloaded method named contains(MyPoint thing) that takes a MyPoint object and returns if that location is inside the Quadrilateral.

Overloaded method named contains(Quadrilateral thing) that takes another instance of a Quadrilateral object and returns if it is inside the calling Quadrilateral.

Method named overlaps(Quadrilateral thing) that returns true if the shapes overlap. Returns false if the other shape is completely inside or outside of the calling Quadrilateral instance.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions