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)

;

}

}

}

}

[4028 byte] By [ELIJAHa] at [2007-11-27 1:38:55]
# 1
People aren't going to read your mind.Describe your problem thoroughly and precisely. What do you expect to happen? What's happenig instead? If you get an error message, copy/paste the complete message here.
jverda at 2007-7-12 0:51:23 > top of Java-index,Java Essentials,Java Programming...
# 2
> public class TortHare extends Applet[url= http://en.wikipedia.org/wiki/Tourtiere]Tourti鑢e[/url]?
DrLaszloJamfa at 2007-7-12 0:51:23 > top of Java-index,Java Essentials,Java Programming...
# 3
> > public class TortHare extends Applet> > [url= http://en.wikipedia.org/wiki/Tourtiere]Tourti鑢e[/url]?[url= http://en.wikipedia.org/wiki/Tortoise_and_the_Hare]Tortoise+Hare[/url]
pm_kirkhama at 2007-7-12 0:51:23 > top of Java-index,Java Essentials,Java Programming...
# 4
Your WHILE statement is within the DO loop....kick it outa there and you should be okMessage was edited by: desimunda
desimundaa at 2007-7-12 0:51:23 > top of Java-index,Java Essentials,Java Programming...
# 5

It looks like you're trying to create a loop like this.

do

{

//...

while(condition);

}

It should be this.

do

{

//...

}

while(condition);

CaptainMorgan08a at 2007-7-12 0:51:23 > top of Java-index,Java Essentials,Java Programming...