Graphic by Keith Ohlfs

CS111, Wellesley College, Fall 1997

Laboratory #2
[CS111 Home Page] [Syllabus] [Students] [Lecture Notes] [Assignments] [Programs] [Documentation] [Software Installation] [FAQ] [CS Dept.] [CWIS]

CS111 Laboratory assignment 2: Graphics Applets

Due Date: 6:00 p.m., Thursday, September 18.

Working with Symantec Cafe

1. Modifying a graphics Applet (In Class)

Today in lab you will learn how to use the Symantec project manager to put together and run a basic graphics applet, using the java awt. We will first download a pre-written applet, Smiley, from the download subdirectory of cs111 on nike. This applet makes a happy face that looks like this:

Together we will modify this applet, to look like this:

2. Dealing with Common Errors (In Class)

When programming in Java, you will often make mistakes typing or in designing your program code. These mistakes will lead to two types of errors: Compiler errors, which cause error messages during the compilation of your program, and run-time errors, which allow the program to compile, but cause it to do the wrong thing. These errors are often called "bugs". Knowing how to find and correct bugs in your code (known as debugging) is an extremely important skill for a programmer. We will examine some common types of errors.

Modifying Your Own Applet (To be handed in)

Now that you've had a chance to modify and debug some code, it's time to try it on your own. Modify the Grump project so that the mouth is changed to an oval shape and add a blue hat to the head. Change the text to say "Have a Surprising Day!" Now create a duplicate surprise face next to the original, only make it half the size. Do this using "straight line code". Do not use methods, which will be discussed on Tuesday. The final applet should produce something like this:

Turning in Lab2

Name the java file "Surprise.java" and name the html file "surprise.html". When you are finished, upload both of these and your project file into your folder in the CS111 lab2 drop folder on nike.

For more help on using the project manager, check out the Project Manager Help in the documentation page.