Im not very sure on how to store the (x,y) coordinates of the Point2D.Double object into an ArrayList so that I could access them later. I have looked through the Java classes on Point2D.Double, but have only found its constructors and methods and not on how the coordinates can be stored in an ArrayList. I have not much of a lead on this but here's at what I have so far:
public class IrregularPolygon
{
private ArrayList myPolygon;
public IrregularPolygon()
{
}
public void add(Point2D.Double aPoint)
{
myPolygon.add(aPoint);
}
public void draw()
{
DrawingTool pencil;
SketchPad paper;
paper = new SketchPad(450,450);
pencil = new DrawingTool(paper);
}
public double perimeter()
{
double perim = 0;
return perim;
}
public double area()
{
int area = 0;
return area;
}
}
class IPTester
{
public static void main(String[] args)
{
IrregularPolygon poly = new IrregularPolygon();
poly.add(Point2D.Double(50.0, 50.0));
}
}
The lab can be found here: Here
Thanks in advance :)