Question: I am working on Turtle class drawing class with inheritance. How can I have this turtle execute each command in the given list of commands.

I am working on Turtle class drawing class with inheritance.

How can I have this turtle execute each command in the given list of commands. The commands are executed in order that they appear in the give list, and are added to the end of this turtle's collection of commands.

2.Repeat all of the commands that this turtle has previously performed n times.

For example:

Turtle t = new Turtle();

t.walk(0.2);

t.turnLeft(90);

t.repeatCommands(3);// repeat previous commands 3 more times

n the number of times to repeat the commands that this turtle has previously performed

pre condition n >= 0

3.Return a shallow copy of this turtle's collection of commands. So how can I shallow copy of the functions and loops of for the commands.

What kind of way should I apply in these 3 questions?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!