Smiley Face
CPS 004.1, 28 January 2002
You are to write a Java applet that draws a Smiley face like the popular seventies icon that was recently
given the rare honor of appearing on a
postage stamp
and being the price rollback spokesperson for
Wal-mart. You
will use the pre-defined GP classes representing stencil shapes and their attributes to help draw the parts
of the Smiley face. Their interface is described in the documentation
here.
Your job is to put them
together to create your Smiley Face Applet.
This assignment is meant to familiarize you with the following concepts discussed in class and your
reading:
- Instantiating classes (using new)
- Declaring variables
- Sequencing
- Using parameters
Specifications
You should assemble the correct shapes in the correct order to draw your Smiley Face with at least a
head, two eyes, and a smile. You should do all of this in the constructor of the Applet class. Your Smiley
Face should appear in the center of the applet, (200, 200), and be half as big as the applet, (200 pixels
wide). Extra credit will be given for adding interesting extras to your Smiley Face.
An example can be seen online
here.
A worked out example can be seen online
here.
What to hand in
When you are finished, you and your partner should transfer the entire project folder created by Visual
J++ to your respective public_html/cps4 folder in the acpub system and update your course web page to
link to the newly transferred project. To do this, note that your project directory contains an HTML
page, index.html, that links to your applet code in Applet.class. On your web page, remember to include
your partner's name with your link. You can use the FTP program to transfer files from your local
machine to the acpub system.