Computer Science 120
Introduction to Programming

Spring 2012, Siena College

Lab 6: A Loopy Drawing
Due: the start of your next lab session

Your task in lab for this week is to use Objectdraw graphics primitives and some while loops to create a picture. The picture you generate is up to you - it just needs to meet the requirements listed later in this document.

You may work alone or with a partner on this lab.

There is no formal design document to be graded this week, but you are strongly encouraged to begin, as usual, with pencil and paper sketching out a plan before you start coding.

Program Requirements

The picture created by your program must meet the following minimum requirements. You are welcome to go beyond these requirements, but be sure you have not missed any required element before working on extensions.

  1. Your program should include at least one new custom class consisting of multiple components.
  2. You should use at least two while loops to draw repeated components of your drawing.
  3. Your program should draw its picture in at least three phases: part of the drawing should happen when the program starts, the next part the first time the mouse is pressed, the next part when the mouse is pressed a second time, etc.
  4. Your program should reset to the initial picture (before any mouse presses occurred) when the mouse exits the window.

Here are a couple example programs that meet these requirements:

Again, feel free to go beyond this but be sure your program meets these minimal requirements.

Submitting Your Work

Before the start of your next lab session, submit your Java program for grading. There are three things you need to do to complete the submission: (i) place a copy of your Java program into your csis120/hw folder under hw9, (ii) print a copy of your program and hand it to your instructor, and (iii) demonstrate the execution of your program for your instructor.

Don't forget to check your programs for compliance with the Style Guide for CSIS 120 Programs


This assignment is worth 100 points, which are distributed as follows:

> FeatureValueScore
Style, Design, and Efficiency
Appropriate comments 6
Good variable names 4
Appropriate variable declarations 8
Good use of constants 8
Appropriate formatting 2
Does not generate new objects unnecessarily 4
Good overall design and methods 8
Program Requirements
Includes at least one new custom class 10
First repeated component using a while loop 10
Second repeated component using a while loop 5
Part of drawing drawn immediately 5
Part of drawing added on first mouse press 10
Part of drawing added on second mouse press 10
Drawing reverts back to original on mouse exit 10
Total 100