CS 101 - Intro to Computing, Spring 2008

Lab 10

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: Tuesday 4/1/2008 by 11:59 pm

For this lab assignment, complete the following:

    Create a "spirograph" style image. This will be done by repeatedly drawing shapes and where the starting point/orientation is modified between each time the shape is drawn. In this manner the shape is redrawn enough times to sweep out a circle. This will be very close to the code that was done in lecture on March 18th.

    For this lab, take the star shape from lab 9 and repeat it multiple times so it is looks something like:

    The star should be drawn at least 8 times. You can draw it more than 8 times if you wish.

    If you didn't get lab 9 working, the code that could have been used in lab 9 to draw the 5 pointed star is as follows:

        // Create a world
        World world = new World(false);
        Turtle turt = new Turtle(world);
        turt.turn(18);
    
        // Draw a pentagram
        int loopCount;
    
        loopCount = 0; 
        while (loopCount < 5)
          {
           turt.forward(100);
           turt.turn (144);
           loopCount++;
          }
        
        world.show();
    

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

  1. You are also to submit the Java file electronically by using the UNIX turnin command.

    To use the UNIX turnin command to electronically hand-in your html file using the project name of lab10. To submit the file in <filename> for lab10, the turnin command is entered as:

         turnin -c cs101 -p lab10 <filename>
    
    To verify what you submitted using the turnin command type:
         turnin -c cs101 -p lab10 -v
    

Grading Criteria