C SC 160 Project 1

This lab project consists of solving some programming Problems related to the Turtle Graphics package that you used in the first two lab explorations. Remember that individual work is expected on the lab projects!

  1. Write a drawLine method that works like move, but puts the turtle back in its original position and direction. Add this method to the SmartTurtle class.

  2. Write a method called drawRaysthat draws lines rotated about a circle, with all lines the same length. For example, to make myTurtle draw 15 rays of length 300, write myTurtle.drawRays(15, 300). Here's the result:

    The rays should be rotated evenly about a circle. The turtle should start and stop at the same location and facing the same direction. Add the method to the SmartTurtle class. (Hint: Use drawLine.)

  3. Write a program (RayBurst.java) that makes multiple calls to drawRays from the previous problem to draw a design similar to this:


Turn in (email) the two Java files you create: SmartTurtle.java and RayBurst.java.

Extra credit:

If you can modify the code that computes the angles so that angles that don't evenly divide 360 work correctly
(e.g., myTurtle.drawRays(64, 300)), I will add 5% to your grade for the project.