CS 112b
Spring 2005
Ileana Streinu
Homework 2
Thursday 3 February, 2005
Part I due Monday 8/2/2005 by midnight. Part II due Wednesday 10/2/2005 by midnight
Outline
This homework has two parts. Part I asks you to finish all the small exercises
started in class on Thursday, and consists mainly in understanding and modifying
pre-existing code. Part II asks you to create a Java applet from scratch.
Part I
From All Exercises, you must have done all exercises from 08-16.
The same requirements apply as in Hwk 1, regarding:
- organization of code into directories
- readability and comments
- visible on the web
- documented with javadoc
- done in time: notice that Part 1 MUST BE COMPLETED BY MONDAY NIGHT.
Part II
This part combines ideas from all the exercises you did so far in the labs. You must develop your code by adding the features in the order
indicated below: do not attempt to do everything at once. Incorporate new features only after the previous ones are functional.
Create a Java applet to draw an interactive Postcard. Use the Pumpkin as a basic model.
You may do: a snow man, a valentine card, a card from Smith College, a birthday card - anything you want. The requirements are
technical and must be fully obeyed, but the topic of your design is left to your imagination.
- There must be some graphics on the card, with at least 4-5 graphics elements such as lines, circles, rectangles or
polygons, filled or empty. The graphics must represent something recognizable as a real-life object.
- There must be some image on your card. The image is imported from a .gif file, not drawn with Graphics primitives.
- There must be at least 2 control buttons on your card. One button should be used to Change the drawing in some way,
for instance to change color, size, or just to show or hide features. Another button should be used to Clear
the drawing and start over.
- There must be at least 3 buttons that control the Color of the background. These must be placed on a
separate panel and be colored with the corresponding color.
- The appearance of the applet should be designed using a layout and different
smaller panels. For instance, use a panel for all the color buttons, a panel
for the Clear and Change buttons, and a separate canvas for the actual drawing.
- There must be an active text field. I leave it to your imagination to do whatever you want with it (set up
shapes or sizes, messages or greetings, whatever you want).
General Guidelines
You can discuss technicalities with your lab partner or the TA, but the design and programming should be entirely yours.
The grade for part 1 of the homework is based on the same general guidelines as in Hw 1. The grade for
part 2 of the homework will be based on the following criteria:
- Does it work?
- How many Java features it uses. Were they added in stages? Were intermediate versions
kept?
- Is it well documented, readable?
- Overall creativity.
Ileana Streinu