CS 101 - Intro to Computing, Spring 2008

Lab 4

Java Programming

When doing Java Programming,it is very important to follow a basic Java Template. Below is a file called Template.java

/**
 * Class for creating a template for a simple Java program
 * 
 * @author Pat Troy: troy AT uic DOT edu
 */

// Note the name of the class in the following line MUST
// match the name of the file.  This is stored in a file
// named: Template.java 
public class Template 
{
  
  public static void main (String[] args) 
  {
    System.out.println("Begin Java Exection");
    System.out.println("");


    // put your Java Program here


    System.out.println("");
    System.out.println("End Java Exection");
  }
} // end of Template class

Lab Assignment

Due: Thursday 9/25/2008 by 11:59 pm

For this lab assignment, complete the following:

  1. Using the turtle drawing features, create an image/world that contains a set of concentric shapes. The shapes can be any that you want (squares, octagons, triangles, etc). All of the shapes in the set should have same center location. An example of this is as follows:

    or

    Your set should have the shape repeated at least 8 times with the sides of each shape being slightly longer that the one closer to the center. The loop variable that keep track of how many shapes to draw was used to calculate the length of each side.

    The key to this lab is to move the turtle to the proper location (with the pen UP!) after one shape is drawn and before the next shape is drawn. For the squares shown above, the starting/ending point of each square is the lower left corner. The turtle moves left by a certain amount and then down by that same amount to get in position to draw the next square.

    Be sure to change comment with the name of the author to contain the following:

  2. You are also to submit the Java file electronically by to the Digital Drop Box inside of Blackboard. You only need to submit the java source code file. Please make sure you identify your submission with the name of Lab 4.

  3. You are also to submit a hardcopy of your java source code file. You can