/** * Class for a simple turtle drawing * * the turtle will draw a square * * @author Pat Troy: troy AT uic DOT edu */ // allows usage of the non-default libraries import java.awt.*; public class Lect128c { public static void main (String[] args) { System.out.println("Begin Java Exection"); System.out.println(""); // create my turtles World w = new World (); Turtle t = new Turtle (w); t.setPenWidth (5); // draw a square with my turtle t.forward (100); t.turn (90); t.forward (100); t.turn (90); t.forward (100); t.turn (90); t.forward (100); t.turn (90); //move turtle to a different location t.penUp (); t.turn (-90); t.forward (150); t.turn (90); t.penDown(); // draw a blue triangle with my turtle t.setPenColor(Color.blue); t.forward (100); t.turn (120); t.forward (100); t.turn (120); t.forward (100); t.turn (120); //move turtle to a different location t.penUp (); t.turn (-90); t.forward (150); t.turn (90); t.penDown(); // draw a red triangle with my turtle t.setPenColor(Color.red); t.forward (100); t.turn (60); t.forward (100); t.turn (60); t.forward (100); t.turn (60); t.forward (100); t.turn (60); t.forward (100); t.turn (60); t.forward (100); t.turn (60); // display the world with the turte w.show(); System.out.println(""); System.out.println("End Java Exection"); } } // end of class