We can't do your school work for you, but I suggest experimenting with boolean variables. For example, for the part where you want the cars to stop, make it so whenever the car moves, it checks the boolean to see if it should move or not. i.e
Code:
if canMovecar move forward 1m 0.25 seconds
you can loop this until the car reaches the finish. You can also do the same thing with a while loop.
Code:
while canMovecar move forward 1m 0.25 seconds
when either car reaches the finish, set canMove to false...
I hoped this helped!