The objective of the game is for four race cars (mine are poorly drawn) to race and for the program to first ask the user what car they think will win and then determine if they are right. That's where im stuck. I'm suppose to determine how far each car is using the x position. But i'm sure how to act on that, thanks in advance,
bobmasta5

p.s. if i figure that out, the next thing i have to do is ask the user to bet on the car and they start out with a free $100 and everytime they get a car right they win double money but if they lose then they get nothing back obviously.

code
// The "RaceCar" class.
import java.awt.*;
import hsa.Console;

public class RaceCar
{
static Console c; // The output console

public static void main (String[] args)
{
c = new Console ();

// Place your program here. 'c' is the output console
int randNum1, randNum2, randNum3, randNum4, userBet;
int userCash = 100;
int redCarX = 10; //the initial X location of the red car
int greenCarX = 10; //the initial X location of the red car
int blueCarX = 10;
int orangeCarX = 10;
String userCar;
c.println ("WELCOME TO THE CAR RACE!");
c.println ("You are given $100 to start betting on the cars!");
c.println ();
c.print ("How much would you like to bet this race? ");
userBet = c.readInt ();
userCash = userCash - userBet;
c.println ("You now have " + userCash + " dollar/s left.");
c.print ("What car do you think will win? (green, blue, red, orange): ");
userCar = c.readLine ();
//determine the winning car using if statements
**this is where im stuck**
//display the race track on the screen
drawTrack ();

//race until someone hits the finish line
while ((redCarX < 520) && (greenCarX < 520) && (blueCarX < 520) && (orangeCarX < 520))
{
drawRedCar (redCarX); //draw the red car at the red X location
drawGreenCar (greenCarX); //draw the green car at the green X location
drawBlueCar (blueCarX);
drawOrangeCar (orangeCarX);
delay (100); //pause so the user can see the car
c.clearRect (redCarX, 150, 70, 40); //erase the car
c.clearRect (greenCarX, 195, 70, 40); //erase the car
c.clearRect (blueCarX, 245, 70, 40);
c.clearRect (orangeCarX, 295, 70, 40);
randNum1 = (int) (Math.random () * 20);
randNum2 = (int) (Math.random () * 20);
randNum3 = (int) (Math.random () * 20);
randNum4 = (int) (Math.random () * 20);
redCarX += randNum1; //make the red car X location bigger to move the car
greenCarX += randNum2; //make the green car X location bigger to move the car
blueCarX += randNum3;
orangeCarX += randNum4;
}
drawGreenCar (greenCarX); //draw the green car at the final location
drawRedCar (redCarX); //the race is over; draw the car at the final location
drawBlueCar (blueCarX);
drawOrangeCar (orangeCarX);

} // main method


public static void delay (int milliseconds)
{
//Accepts a number and pauses the program for that number
try
{
Thread.sleep (milliseconds);
}
catch (InterruptedException e)
{
;
}
}


public static void drawRedCar (int xLocation)
{
//Accepts a number that represents the number of pixels
//from the left of the screen and draws a car based on that location
c.setColor (Color.red);
c.fillRect (xLocation + 10, 150, 30, 15); //windows
c.fillRect (xLocation, 165, 70, 20); //body of car
c.setColor (Color.black);
c.fillOval (xLocation + 5, 175, 15, 15); //the tires
c.fillOval (xLocation + 55, 175, 15, 15);
c.drawRect (xLocation + 10, 150, 30, 15);
c.drawRect (xLocation, 165, 70, 20);
c.setColor (Color.white);
c.fillOval (xLocation + 8, 178, 8, 8); //the tires rims
c.fillOval (xLocation + 58, 178, 8, 8);
}


public static void drawGreenCar (int xLocation)
{
//Accepts a number that represents the number of pixels
//from the left of the screen and draws a car based on that location
c.setColor (Color.green);
c.fillRect (xLocation + 10, 195, 30, 15); //windows
c.fillRect (xLocation, 210, 70, 20); //body of car
c.setColor (Color.black);
c.fillOval (xLocation + 5, 220, 15, 15); //the tires
c.fillOval (xLocation + 55, 220, 15, 15);
}


public static void drawBlueCar (int xLocation)
{
//Accepts a number that represents the number of pixels
//from the left of the screen and draws a car based on that location
c.setColor (Color.blue);
c.fillRect (xLocation + 10, 245, 30, 15); //windows
c.fillRect (xLocation, 260, 70, 20); //body of car
c.setColor (Color.black);
c.fillOval (xLocation + 5, 270, 15, 15); //the tires
c.fillOval (xLocation + 55, 270, 15, 15);
}


public static void drawOrangeCar (int xLocation)
{
//Accepts a number that represents the number of pixels
//from the left of the screen and draws a car based on that location
c.setColor (Color.orange);
c.fillRect (xLocation + 10, 295, 30, 15); //windows
c.fillRect (xLocation, 310, 70, 20); //body of car
c.setColor (Color.black);
c.fillOval (xLocation + 5, 320, 15, 15); //the tires
c.fillOval (xLocation + 55, 320, 15, 15);
}


public static void drawTrack ()
{
//Draws the race track and finish line on the screen

//the top and bottom of the race track
c.fillRect (10, 100, 600, 3);
c.fillRect (10, 400, 600, 3);

//draw the checkered finish line
for (int i = 10 ; i < 490 ; i++)
{
c.setColor (Color.black);
c.drawLine (597, i, 597, i + 20);
c.setColor (Color.black);
c.fillRect (600, i, 10, 10);
c.setColor (Color.white);
c.fillRect (610, i, 10, 10);
c.setColor (Color.white);
c.fillRect (600, i + 10, 10, 10);
c.setColor (Color.black);
c.fillRect (610, i + 10, 10, 10);
c.setColor (Color.black);
c.drawLine (623, i, 623, i + 20);
i += 20;
}
}
} // RaceCar class

code/