Question: import java.awt.geom.*; public abstract class Polygon { private Point2D[] myPoints; private String myName; // yeah, this allows someone to pass in an array of //
import java.awt.geom.*; public abstract class Polygon { private Point2D[] myPoints; private String myName; // yeah, this allows someone to pass in an array of // length 10, but yet call the Polygon a triangle public Polygon(Point2D[] points, String name) { myPoints = points; myName = name; } public Point2D[] getPoints() { return myPoints; } public String getName() { return myName; } public double perimeter() { double thePerimeter = 0; for(int i = 0; i ![import java.awt.geom.*; public abstract class Polygon { private Point2D[] myPoints; private String](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4e526881d7_47866f4e52628f2d.jpg)
b) Create the abstract class Quadrilateral, which is a Polygon * This class will simply have a constructor to initialize Polygon's array c) Create the class Square which is a Quadrilateral. * The area method will compute base * height, where, given any three consecutive points in the array, the first two points could be considered the base, and the last two could be considered the height d) Create the class kite, which is a Quadrilateral. * This class has two private doubles representing the lengths of the diagonals of the Kite, though the constructor will not require parameters for these privates * The constructor will call a method calculate Diagonals(), which willinitialize the privates by assigning the distance between the Point2D objects at indices and 2 of the array to the first private, and the distance between the Point2D objects at indices 1 and 3 to the second private Method area will calculate and return one-half the product of the diagonals Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
