CS 117 Assignment: Sorted fish
Assigned Friday, 2/15/02.
Due Tuesday, 2/19/02 by 9:00 PM.
Just as in the Fish assignment, I want you to
generate ten random fish. But this time, your program should do
the following:
- Generate ten fish with random position (x and y between 0 and 500),
random direction (left or right), and random color (red, blue, green, or yellow)
and store them in an array of Fish.
- Draw the rightmost fish, pause 1/4 second, draw the second rightmost
fish, pause 1/4 second, etc. until all the fish have been drawn in
their original colors.
- Pause two seconds.
- Redraw the topmost fish in black, pause 1/4 second, redraw the second topmost
fish in black, pause 1/4 second, etc.
This will require that you (1) sort your array of fish in decreasing order
with respect to their x coordinates, (2) sort your array of fish in increasing
order with respect to their y coordinates, and (3) figure out how to use
System.currentTimeMillis() to pause 1/4 of a second.
Start early, have fun, and keep in touch.