Project 3 - A Turtle Drawing
Due Date: Thursday 4/10/2008 at 11:59 pm
For this project, we will want to use the Turtle class to
draw a large multifaceted geometrical shape onto a picture.
These modifications are to add "something" to the image. Normally
this would be to draw something in the foreground of an image
that is just a scene.
Examples of such drawing can be shown by these
examples.
The objectives of this assignment are to have you define your own Java
methods to add to the basic behavior of the Turtle Java class. You will
write Java methods with and without parameters. You will then write a Java
main program to call on those Java methods to draw connected multifaceted
geometrical shapes that you have designed.
Requirements
- Design the shapes you want drawn. You should have a minimum
of 10 different shapes that are connected to create a large multifaceted shape -- a building for example.
- Define and write methods for the Turtle class. At a minimum, you should include the following methods:
- The three methods to draw squares given in the textbook
(see pages 53, 56 and 57)
- A method to draw a rectangle of a specified width and height (e.g., the Turtle can be asked to draw rectangles of different dimensions by a call to the same method)
- A method to draw a diamond of a specified length (e.g., the Turtle can be asked to draw diamonds of different lengths)
- A method to draw a hexagon of a specified length and color (e.g., the Turtle can be asked to draw hexagon of different lengths and colors).
- Three other methods to draw shapes of your own choosing. All methods must be flexible to allow the shape to be drawn in different sizes, or line thickness, or pen color.
- Write a Java program (e.g. one with a class method named main()) that does the following:
- Creates a Picture for the turtles
- Creates at least two Turtles in the Picture
- Uses variables to keep track of pen widths, pen colors, shape lengths.
- Calls methods on each of the two Turtles to create a
multifaceted geometrical shapes on the Picture. For example, you
could draw multiple cabins in a beach picture along with sea stars or draw a blueprint of your dream home.
- Moves the turtles to different locations in the Picture and changes their orientation in order to draw the shapes as desired.
- Draws shapes by changing the default behavior of each Turtle object. For example, you can change the color and thickness of the pen used in drawing the shapes.
- Makes non-trivial use of the following Turtle methods: penDown(), penUp(), setHeading(), turnToFace().
Project Collaboration
You are allowed to receive help on this project from other
students who are also taking CS 101. Each student must still
complete and submit his/her own project. You will be required
to include a Collaboration Statement somewhere on your
project if you receive help. This statement can simply be
something like the following:
For this project, I received help from the following member of CS 101.
This statement should list each helping student's name
in a comment in the "header comment" of your Java file that
includes the main() method.
Submission of your Project
In addition to displaying your weblet on the inernet,
you must electronically submit all of your files (all .java files,
any image files and any other files used)
via the UNIX turnin command using the project name of proj3.
The easiest way to
submit the UNIX turnin command,
is to create a directory that contains
all of the files needed for your project. Then you
turnin the entire directory.
For example, assume you create a subdirectory in your WWW
directory called proj3directory. In this "proj3directory" directory
you contain
all of the files needed for this assignment. If you are in your
WWW directory, you can the type in the command:
$> turnin -c cs101 -p proj3 proj3directory
To verify what you submitted using the turnin command type:
$> turnin -c cs101 -p proj3 -v
This project was modified from project by
Dr. Alvaro Monge
for
CECS-174 at CSULB.
CS 101 Home Page
Department of Computer Science
University of Illinois at Chicago