CPSC 120A -- Assignment #2
Something Fishy
Due Friday, October 10, 2003 by 4 p.m.
Write a Java applet to display a fishy scene with the following features:
- A sky and an ocean (mostly ocean)
- Two Pac-man style "fish" (similar to that below)
of random size and at random locations in
the ocean. The fish should be a reasonable size and completely fit in
the applet window (and in the ocean!). If the fish overlap, the smaller
one should be in front of the larger one. The fish should be different
colors (you may also use random colors if you wish). The fish must
have a body, a tail, and at least 3 bubbles coming out of their mouths.
- A cloud, sun, or some sea creature according to the following rule:
Generate a random point on the screen. If the point is in the left
half of the sky, draw a sun in the upper left hand corner (a quarter-circle
sun with at least 5 rays); if the point is in the right half of the
sky draw a cloud at the point (it doesn't matter where on the cloud
the point lies); if the point is in the ocean draw a sea critter of
some sort at the point(this is where you get to be creative but I recommend
that you keep it simple).
- Draw your name in the lower right hand corner.
You will need to construct an html file to display your applet.
Other Requirements
As usual, use good programming techniques. You should use good
variable names, constants where appropriate, whitespace, and
correct indentation and alignment of statements (emacs will do this
for you if you let it!). Documentation must include a header with
the file name, your name, the date, and a clear, complete description
of what the program does. The program should be broken up
into logical sections and each section should be
documented with a brief description of what it does.
The hardest part of this assignment is fitting the pieces of the
fish together. You can't easily use literal values for the drawing
parameters since the fish
are at random positions and are random sizes. However, you will have several
literal values in the program (for example, the values you use for
generating the random size and position)
and you should used named constants for them.
Hand In
Turn in a printed copy of your program (the source code). Tar your
directory containing the project and email the tar file to ingram@roanoke.edu.
Academic Integrity Reminder!!! Programming
assignments are to be your own work. You may get help on the specifics
of the assignment from no one except the instructor. You may not show
your program to anyone or look at anyone else's program code (you may
view each other's applets, just not the code that made the applet)
or share ideas with anyone about how to write the program.