Question: a) Create an abstract class Polygon with the following attributes and behaviors: * private array of Point2D objects (private Point2D[]), which stores the coordinates of

 a) Create an abstract class Polygon with the following attributes and

a) Create an abstract class Polygon with the following attributes and behaviors: * private array of Point2D objects (private Point2D[]), which stores the coordinates of the vertices (x,y) of each vertex of the Polygon (it will be assumed that the points are placed in consecutive order so that, if we were to draw lines connecting these points(vertices), no lines would intersect) private String forthe name of the type of Polygon ("Square", for example) * Constructor that receives a Point2D array (of length at least 3) and a String as parameters * Method double perimeter(), which adds the distances between each pair of consecutive points in the array (note, the Point2D class has a method distance(Point2D point2) that will compute the distance from the Point2D calling the method to the point2D passed into the method * Method Point2D[] getPoints(), which returns the array * Abstract method double areal), for which subclasses will be required to implement to calculate the area of the Polygon a) Create an abstract class Polygon with the following attributes and behaviors: * private array of Point2D objects (private Point2D[]), which stores the coordinates of the vertices (x,y) of each vertex of the Polygon (it will be assumed that the points are placed in consecutive order so that, if we were to draw lines connecting these points(vertices), no lines would intersect) private String forthe name of the type of Polygon ("Square", for example) * Constructor that receives a Point2D array (of length at least 3) and a String as parameters * Method double perimeter(), which adds the distances between each pair of consecutive points in the array (note, the Point2D class has a method distance(Point2D point2) that will compute the distance from the Point2D calling the method to the point2D passed into the method * Method Point2D[] getPoints(), which returns the array * Abstract method double areal), for which subclasses will be required to implement to calculate the area of the Polygon

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!