Do While Loop
I don't understand what's going wrong with this. Can some1 help?import java.applet.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;//Option Panes library.
publicclass TortHareextends Applet
{
int txold = 5;//old position
int tyold = 25;//old position
int tx = 5;//new position
int ty = 25;//new position
int finishline = 500;
int hxold = 5;//old position
int hyold = 50;//old position
int hx = 5;//new position
int hy = 50;//new position
{
do
{
long random = Math.round (Math.random () * 99) + 1;
if (random >= 1 && random < 41)
tx += 30;//moves forward
elseif (random >= 41 && random < 51)
ty += 20;// move down
elseif (random >= 51 && random < 61)
tx -= 60;
elseif (random >= 61 && random < 71)
ty -= 20;
elseif (random >= 71 && random < 101)
tx += 30;
g.drawLine (txold, tyold, tx, ty);
txold = tx;
tyold = ty;
while (tx < finishline)
;
}
{
do
{
long random = Math.round (Math.random () * 99) + 1;
if (random >= 1 && random < 21)
hx += 0;
elseif (random >= 21 && random < 41)
hx += 90;
elseif (random >= 41 && random < 46)
hx -= 120;
elseif (random >= 46 && random < 51)
hy -= 70;
elseif (random >= 51 && random < 76)
hx += 10;
elseif (random >= 76 && random < 91)
hy += 40;
elseif (random >= 91 && random < 101)
hx -= 20;
g.drawLine (hxold, hyold, hx, hy);
hxold = hx;
hyold = hy;
while (hx < finishline)
;
}
}
}
}

