Thx for the help for my other two programs.
Here is a hard one; it is about makeing irregular polygon; i could not figure it out, help pls....
1. Implement a class IrregularPolygo n that contains an array list of Point2D.Double objects.
2. The Point2D.Double class defines a point specified in double precision representing a location in (x, y) coordinate space. For example, Point2D.Double( 2.5, 3.1) constructs and initializes a point at coordinates (2.5, 3.1).
3. Use the following declarations as a starting point for your lab work.
import java.awt.geom.* ; // for Point2D.Double
import java.util.Array List; // for ArrayList
import gpdraw.*; // for DrawingTool
public class IrregularPolygo n{
private ArrayList <Point2D.Double > myPolygon;
// constructors
public IrregularPolygo n() { }
// public methods
public void add(Point2D.Dou ble aPoint) { }
public void draw() { }
public double perimeter() { }
public double area() { }
}
Here is a hard one; it is about makeing irregular polygon; i could not figure it out, help pls....
1. Implement a class IrregularPolygo n that contains an array list of Point2D.Double objects.
2. The Point2D.Double class defines a point specified in double precision representing a location in (x, y) coordinate space. For example, Point2D.Double( 2.5, 3.1) constructs and initializes a point at coordinates (2.5, 3.1).
3. Use the following declarations as a starting point for your lab work.
import java.awt.geom.* ; // for Point2D.Double
import java.util.Array List; // for ArrayList
import gpdraw.*; // for DrawingTool
public class IrregularPolygo n{
private ArrayList <Point2D.Double > myPolygon;
// constructors
public IrregularPolygo n() { }
// public methods
public void add(Point2D.Dou ble aPoint) { }
public void draw() { }
public double perimeter() { }
public double area() { }
}
Comment