/** * A simple Turtle drawing program * * @author Pat Troy: troy AT uic DOT edu */ // add import statements to get items from Java libraries import java.awt.Color; // Note the name of the class in the following line MUST // match the name of the file. public class Lect0913c { public static void main (String[] args) { System.out.println("Begin Java Exection"); System.out.println(""); // put your Java Program here // Step 1. Create the world Picture p; p = new Picture ("C:\\Documents and Settings\\Pat Troy\\My Documents\\My Pictures\\beach.jpg"); // Step 2. create the turtle Turtle t; t = new Turtle (50, 320, p); // step 3. Move the turtle t.setPenWidth(5); // draw a square t.forward (150); t.turn (90); t.forward (150); t.turn (90); t.forward (150); t.turn (90); t.forward (150); t.turn (90); // example of a while loop int count; // draw a "circle" t.setPenColor(Color.MAGENTA); int numSides; int degrees; numSides = 30; degrees = 360 / numSides; count = 0; while ( count < numSides) { t.forward (10); t.turn (degrees); count = count + 1; } // Final step, Show the world the turtle lives in p.show(); System.out.println(""); System.out.println("End Java Exection"); } } // end of Template class