Code:
Crayon class:
public void draw (Graphics screen, int x, int y) {
screen.setColor(crayonColor);
int xcoords [] = {x+50,x+25,x+150,x+150,x+50};
int ycoords [] = {y+50,y+0,y+50,y+550,y+550};
screen.fillPolygon(xcoords,ycoords,5);
}
The applet I'm making is supposed to draw 8 crayons with a random color and different heights. Here is my code so far: