CPSC 120 Assignment #2
Completed Assignment: Friday October 27, 2006 by 4:00 p.m.
In the final phase of the project you will use your Umbrella, Cloud, and
Raindrop classes in two applets. You need to create the following two
files (plus HTML files for each since they are applets):
BeachScene.java This file will contain a main applet that
draws a beach scene with a sun, a few white clouds, sand, ocean,
and two large open beach umbrellas. The requirements are as follows:
- The size of the applet should be 600 by 400.
- There should be a sun, sand, ocean and sky in the scene.
- There should be at least 3 white clouds in the sky.
- There should be two umbrellas in the scene at random positions
from left to right in the applet and random
size (in the range 175 to 250 pixels). The umbrellas
should be two different colors. When drawing the umbrellas
the largest one should appear closer than the other one - that is,
it should be further down the page. Also it should
obscure any part of the farther one that it may overlap.
Be sure that both umbrellas have the bottom of the pole in the sand.
The other parts of the umbrella may appear to extend into the ocean
- Your applet should be "signed" - that is, your name should be drawn
somewhere on the applet.
WeatherScene.java This file will contain a main applet that
draws a weather scene. The applet needs to do the following:
- The size of the applet should be 500 by 300.
- Determine what type of day it is assuming there is a 35%
chance of a sunny day, 40% chance of a cloudy day, and 25% chance of
a rainy day. See the note below on how to do this.
- If it is a sunny day your applet should draw a sun and a closed
umbrella; if it is a cloudy day your applet should instantiate and
draw at least 4 light gray clouds (at least two that slightly overlap)
and a closed umbrella; if it is a rainy day your applet should
instantiate and draw at least 4 dark gray clouds that are raining
(use the rain method!!) and an open umbrella.
- Your applet should have your name drawn on it.
- Extra Credit (5 points): Include a stick figure holding the
umbrella. Use the StickFigure class defined in the file
StickFigure.java to instantiate and
draw the stick figure.
- NOTE - Determining the type of day: The type of day should
be randomly generated. There are several ways to do this using the
probabilities above. The two most straightforward ways are as follows
(choose just one to use!):
NOTE: See the description of phase I for documentation and
Academic Integrity Reminder!!! Programming
assignments are to be your own work (this includes Phase I of this
assignment). 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 or share ideas
with anyone about how to write the program.