
March 5th, 2013, 12:54 PM
|
|
Registered User
|
|
Join Date: Mar 2013
Posts: 1
Time spent in forums: 19 m 20 sec
Reputation Power: 0
|
|
|
Homework - DrawLine loop
c. (10 points) Instead of using *s, use line segments for the plot. You must use a loop, not just draw the lines using separate drawLine() calls. No asterisks will be displayed. To draw a line, you need two points. You will have to remember the the first point's place in order to draw the line between the first and second point. Then you have to draw a line from the second to the third point.
This is sort of a fence post problem. Set up the first point with coordinates oldX and oldY before the loop. In the loop generate newX and newY for the second point. Draw the line. Give oldX and oldY the values of newX and newY. Continue looping.
This is what I have to do for my homework.
This is the code I already have and it's not working.
I'm not sure how to make it so the line loops replacing the previous coordinates.
|