CS 201 - Computer Science I - Spring 2009
Lab 7 - Graphics and Selection


Loyola College > Department of Computer Science > Dr. James Glenn > CS 201 > Labs > Lab 7

Due

Monday, March 16th at 11:59pm. Labs submitted one day late will be assessed a 20% penalty. Labs will not be accepted more than one day late.

Objectives

Reading

Anderson and Franceschi, Chapters 4 and 5

Assignment

Add code at the specified location in AnimatedAppletL7.java that draws a simple picture. Your picture should use

You should also strive to have your drawing scale to fit the size of the applet.

In addition, you should use selection (if and if/else) statements to satisfy the following:

To determine when to draw what, you will need to use conditions that involve the frame variable that is set up at the beginning of paint in the provided code. The frame variable keeps track of how far the animation is into a 10 second cycle, counting by fifths of a second. The values for frame will therefore be between 0 and 49 (inclusive) and so if you want something visible only half of the time, you could write a selection statement with a condition that expresses "frame is between 0 and 25".

For complete information on the methods to use from the Graphics class, see the documentation.

Suggestions

Make a sketch of your drawing on paper and try to figure out what all the coordinates will be before writing the code.

Extra Credit

Submissions

Submit the source code (.java file) for your AnimatedAppletL7 class.
Valid HTML 4.01 Transitional