Graphic Java

Java provides a method for filling polygons called fillPolygon. To use it the student must first create and populate arrays representing the points of the corners of a polygon:

    int x[]=new int[16];
    int y[]=new int[16];
    x[0]=10;             y[0]=10;
// insert all the other points here
    x[15]=10;            y[15]=20;
Then the student may make the actual call to fillPolygon:
    g.fillPolygon(x,y,x.length);
EXAMPLE: The student will create an applet like the one shown here. This activity provides the student with practice using the fillPolygon method.
x

ASSIGNMENT:
Recreate the applet shown above using the fillPolygon method. Actually two stars are drawn here. First a large yellow star is created and then a smaller black one is created.