The student will create an interesting pattern using drawLine and for loops.
EXAMPLE: The student will create an applet like the one shown here. This activity provides the student a chance to make an interesting pattern using drawLine and a for loop. |
x |
ASSIGNMENT:
Here's some code to help you get started:
public void drawWeb(Graphics g, int a, int b, int x, int y, int xinc, int yinc){ for(int c=0; c < 11; c++){ g.drawLine(a,b,x,y); b+=10*yinc; x+=10*xinc; } }
drawWeb(g, 10,110,10,10,1,-1);