Question: Implement a class Polygon that contains an array list of Point2D.Double objects. Sup port methods: Draw the polygon by joining adjacent points with a line,

Implement a class Polygon that contains an array list of Point2D.Double objects. Sup port methods:

public void add (Point 2D.Double aPoint) public void draw (Graphics2D g2)

Draw the polygon by joining adjacent points with a line, and then closing it up by joining the end and start points. Write a graphical application that draws a square and a pentagon using two Polygon objects.

public void add (Point 2D.Double aPoint) public void draw (Graphics2D g2)

Step by Step Solution

3.44 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement a Polygon class with the specified functionality you can use Javas AWT and Swing libraries for the graphical interface The Point2DDouble ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!