CS 231: Introduction to Programming
Lab 2: Drawing Graphics Under Program Control

Assigned: Wed 26 Jan 2000
Due: Mon 31 Jan 2000

In this lab, like the last one, you will run a Java program in order to draw some simple graphics on the computer screen. Unlike the last lab, however, you will write (portions of) the program yourself. And unlike in the last lab, in this one it will be your program which will do the drawing rather than you (with the mouse).

In preparation for (or during) this lab, you should read Chapter 2 of the text; you will in any case want to keep it handy during the lab as a reference.

Note especially the code template in Figure 2.16 on page 72 and the table of methods in Table 2.1 on page 73.

Contents


Basic instructions

In order to fulfill the assignment, you should write a Java applet which draws a picture on the screen. Your picture should have at least 3 stick figures (representing people) and some text (a caption, labels for the figures, slogans, etc.). Feel free to be as creative as you like with your drawing, but there is no need to do anything fancy: this is not an art class, just a programming class!

As an example of the sort of drawing which would meet the minimum requirements (and which conveys a sense of the minimal artistic talent required), consider the following example:

Remember, your job is to write a program which will draw a scene such as this one, not to make the drawing yourself with the mouse. This will necessarily limit what you can do because of the paucity of tools available (if you can get a simple example working fully, you are of course welcome to explore more the sophisticated options which are available, but they won't count for extra credit).

For your demo I may ask you to make small modifications to your program, so make sure everything is working by then and that you understand enough of the process to be able to "tweak" it. You may want to practice a few such changes before you commit to a demo.

Tips and hints


What to expect for your demo

You should have your program complete and ready to go by the time you ask for a demo. You should also bring a completed demo form (I will pass out final versions before the due date).

Most of the grade for this assignment will be in getting your program to compile and run correctly, but some points will also be available for stylistic issues and for the abstraction ideas mentioned above. I will talk more about point allocations in lecture or lab.