Mini-Lab Entrance Assignment:
Intro to Aquarium Lab Series
This assignment will introduce you to a
program that will simulate fish swimming in an aquarium.
Getting Started
- Download and unzip the AquariumLabSeriesUsingBlueJ
project to your CS150 folder.
- Open the Aquarium Lab Series project in BlueJ.
The first thing you'll notice is that this program has more
classes than the other projects we have worked with so far.
You will be learning about and enhancing the Aquarium simulation
program over the next couple of weeks, and during that time you will
become familiar with these classes and how they relate to each
other. For now, though, we will consider just four:
- The AquaSimApplication class contains the
main
method to start the program.
- An Aquarium object represents the
aquarium in which fish will swim.
- AquaFish objects represent the
fish swimming in the aquarium.
- An AquaSimGUI object provides a graphical
user interface (display and control button) for the simulation.
- Run the Aquarium simulation using
main
.
As a quick way to become familiar with what the Aquarium simulation
program does, compile and run the program using the main
method in the AquaSimApplication class. You should see a
window appear with a Start button and some instructions at the
bottom. This is the program's graphical user interface.
When you press the Start button, you should see
an empty
blue background (the aquarium). That is
all the program does for now. Close the graphical user
interface window.
Preparation for First Aquarium Lab Series Mini-Lab
Analysis Questions
- Why do you think the AquaFish and AquaSimGUI constructors
ask for the aquarium as a parameter?
- Why does the Aquarium "add" method take a parameter but the
AquaFish "moveForward" method and the AquaSimGUI "showAquarium"
methods do not?
- What do you think happens when you move a fish forward a number of
times in a tall, thin aquarium? (This will be the focus of a
future lab exercise.)
-
Focus on the statements in the
main
method
that construct an
Aquarium
object.
Compare them with the
specification for the
Aquarium
constructor in the Aquarium
class documentation. How do you explain the differences
between the class documentation specification and the actual code?
Submit the document containing your answers to
the Analysis Questions on Kit.
|