Needed to Write a program dun know how to start Can anyone suggest

Objective

The student will develop classes to implement Dancing

Turtles using the ACM graphics library.

Special Requirement

This assignment uses the acm.graphics package developed by the ACM

and SIGCSE Java task Force,in particular the turtle graphics class

GTurtle.

Running Programs using the Graphics Library

It turns out that it is easier to run Java Applets using

the Graphics library that Java applications. There

is one subtle differences in your code. There is no longer a main()

method. Instead, your main class

implements an instance method named run(). The other difference is

that you choose to run the

program as an applet. In fact, without the main method, the Run As Java Application menu option

doesn't even show up.

Turtle Graphics Background

Using turtles to create graphics goes back to 1967 with the development

of the Logo language by Wally

Feurzeig and Seymour Papert. It uses a set of simple commands to have a

turtle move around a screen,

leaving a drawn path in its wake. This simple approach to creating

graphi

cs has been repeated in many

different places, including the ACM graphics library. If you look at

the GTurtle class in the ACM

library, you see very intuitive methods like forward() and right(angle).

Your instructor has put a copy of a simple Simple Turtle Graphics

program on your course web page.

The easiest way to run this program is to copy it into an eclipse class of the same name. Then choose

Run As -> Java Applet.

Suppose that we would like to model turtles that dance. One kind of

turtle will move according to adance step pattern that is specified by a sequence of directions in which the turtle is to move. This type

of turtle is a lead dancer.

A second kind of turtle is the follower; this turtle will have a reference to

another turtle and will mimic its moves by moving in the same direction

on each move. You are to implement these two turtle classes and any other interfaces and classes you need to get the job done.

TurtleMove class

Develop a small class named TurtleMove. Each object of type turtle move

should have two instance

variables:

?a String named action that contains the action ("forward" or "right")

that the turtle is to do.

?a double named arg that contains the argument (if any) for the action.

The DancingTurtle Interface

Develop an interface named DancingTurtle that contains declarations

for the following two

methods:

public void move();

public TurtleMove getMove();

LeadTurtle

Develop a class named LeadTurtle. Lead turtles extend GTurtle and

implement DancingTurtle.

The LeadTurtle's only constructor takes an array of TurtleMoves as its

parameter. Each time move() is called, the next move in the array is executed. When the list is exhausted, it starts again at

the beginning. A call to getMove() returns the next move that is to be

executed.

FollowerTurtle

This type of turtle is assigned another turtle as its "leader" when it

is constructed (this means that the

other turtle must exist before this turtle is created). The leader is

passed as a parameter to the

constructor. A follower turtle's move() method calls the leader's

getMove() method to determine

what to do next. Note that FollowerTurtles also must implement

getMove(), as a

FollowerTurtle might be another turtle's leader.

Write a separate class with a run method to test your code. Your

instructor will run your test code, but also test your program using his own test driver.

.

[3897 byte] By [misha1981a] at [2007-11-26 17:48:40]
# 1

No one is going to do your work for you. What you need to do is break it down step by step, and implement one feature at a time.

I would start with the TurtleDancerLead and TurtleDancer, and write down what features each would need, and any common features. When you get some code written and get stuck, post what yo uhave here and ask a specific question, and someone will be gald to help.

Quite frankly, I'm somewhat amazed at the amount of info provided to you, everything you need is there, I believe.

~Tim

SomeoneElsea at 2007-7-9 5:01:03 > top of Java-index,Java Essentials,New To Java...
# 2
I assume that YOU are the student so YOU need to study - http://java.sun.com/docs/books/tutorial/ .
sabre150a at 2007-7-9 5:01:03 > top of Java-index,Java Essentials,New To Java...
# 3
thanks I will start working on it and ask doubts.............
misha1981a at 2007-7-9 5:01:03 > top of Java-index,Java Essentials,New To Java...