Activity #5 (lab): Program turtles to draw shapes
The Java code for the problems below must be submitted by 1pm on Thursday Feb. 13th and must be demonstrated to the instructor in lab on Thursday Feb. 13th.
Problems
To solve the following, you must write Java code in the interactions pane of DrJava. Be sure to have configured the classpath in DrJava's preferences to point to the bookClasses directory containing the Java classes provided by the authors of the textbook.
- Start by designing your geometrical shapes, do this by drawing each of them on a piece of paper. Draw a rectangle, diamond, and hexagon. Determine the interior angles of each of your polygons and also determine where you want to draw them on the canvas (the 640x480 World).
- Create a World object. Always choose appropriate names for all variables!
- Create a Turtle object
- Use the Turtle object to draw a rectangle (but, not a square)
- Use the Turtle object to draw a diamond
- Use the Turtle object to draw a hexagon
Useful links
To review needed geometry, you may want to search on Google. I found a page on Interior Angles of Polygons that you will find useful for this assignment.