The student will use both the drawPolygon and fillPolygon methods to complete this assignment.
| EXAMPLE: The student will create an applet like the one shown here. This activity provides the student with practice using the fillPolygon and drawPolygon methods. |
| x |
ASSIGNMENT:
Recreate the applet shown above using the fillPolygon and drawPolygon
methods. The student may find the following code useful:
public void drawOct(Graphics g, int a, int b){
int x[]=new int[8];
int y[]=new int[8];
x[0]=a+6; y[0]=b;
// fill in the rest of the values
x[7]=a; y[7]=b+6;
g.setColor(Color.yellow);
g.fillPolygon(x,y,x.length);
g.setColor(Color.green);
g.drawPolygon(x,y,x.length);
}