This is Exercise 5.14 in the text. Remember that Java monitors are `signal and continue' so be sure to think about the ramifications of this as you design your monitor.
No semaphores and no busy waiting allowed!
Do not use nap()
within a monitor synchronized method.
Do you see why?
Only three nap()'s are allowed in this program:
riders wandering, cars bumping, and one in main() to shutdown
the simulation.
If you have not already done so, animate your program using XtangoAnimator.java.