Java assignment 2: Wator Applet
David Matuszek,
Fall 1998, Villanova University

In this assignment, you are to take the Wator program for the previous assignment and turn it into an applet. The applet should display the contents of the ocean and should provide a GUI (Graphical User Interface) that gives the user some control over the simulation. Here are some suggestions for the controls that you put in the GUI; but they are suggestions only, not requirements. The only requirement is that you provide the user with some control over the simulation.

In the previous assignment you were to read the following input parameters from the command line (or equivalent):
  • Size of the ocean.   
  • Number of steps.
  • Initial number of tuna.   
  • Tuna gestation period.
  • Initial number of sharks.
  • Shark gestation period.
  • Shark starvation period.
Of these parameters, "Size of the ocean" should probably be a constant, based on the height and width of your applet, but that's up to you.

If you try to use threads (strongly recommended), then instead of a fixed "Number of steps" you could have Start and Stop buttons (or a single button whose label changes) to control the simulation.

The other input parameters are all good candidates for things that the user could control. I will provide a "Life" applet that you can use for ideas. It's really pretty much up to you; you can get full credit for a fairly basic implementation.

Turn in:
  • A listing of your source code, and
  • A floppy containing your .html, .java, and .class files, or
  • If it is inconvenient for you to make a floppy, you can e-mail me the .html and .java files, and I will compile and try out your program.

Note that no particular documentation is required for this assignment.