@@ -11,46 +11,50 @@ public ManyAnimals()
1111 {
1212 showSomeTurtles ();
1313 }
14- //create container for Turtles HINT: Use ArrayList
14+ //Create a container to hold your turtles HINT: Use ArrayList --#2.1
1515 public ArrayList <Turtle > turtles = new ArrayList <Turtle >();
16- //create a window for many turtles HINT: Use MultiTurtlePanel
16+ //Create a window to show your turtles HINT: Use MultiTurtlePanel --#1.1
1717 public MultiTurtlePanel mt = new MultiTurtlePanel ();
1818 private void showSomeTurtles ()
1919 {
20- //show the panel
20+ //Show your panel --#1.2
2121 mt .showPanel ();
22- //set the size to 100
22+ //Set the size to 100 --#5.4
2323 int size = 100 ;
24- //add three turtles HINT: FOR loop which 'does an action'
24+ //Add your three turtles HINT: FOR loop which 'does an action' --#2.2
2525 for (int i = 1 ; i <= 3 ; i ++)
2626 {
27- //create a turtle
27+ //Create your turtle --#2.4
2828 Turtle turtle = new Turtle ();
29- //add the turtles to the container for turtles
29+ //Add your turtles to your turtle container --#2.5
3030 turtles .add (turtle );
31+ //Repeat --#2.2
3132 }
32- //add all turtles to the window HINT: Use a foreach loop
33+ //Add your turtles to your window HINT: Use a foreach loop --#3.1
3334 for (Turtle turtle : turtles )
3435 {
35- //NOTE: must call addTurtle BEFORE calling other methods
36- //add all turtles to the window
36+ //Must call addTurtle BEFORE calling other methods --INFO
37+ //Add your turtles to your window --#3.3
3738 mt .addTurtle (turtle );
39+ //Repeat --#3.2
3840 }
39- //teleport all turtles on the window HINT: Use a FOR loop and ZERO
41+ //Teleport your turtles around your window HINT: Use a FOR loop and ZERO --#4.1
4042 for (int i = 0 ; i < 3 ; i ++)
4143 {
42- //set the X position to i*100 + 350
44+ //Get your turtle's current position and then set the X position to i*100 + 350 --#4.3
4345 turtles .get (i ).setX (i * 100 + 350 );
44- //set the Y position to i*100 + 100
46+ //Get your turtle's current position and then set the Y position to i*100 + 100 --#4.4
4547 turtles .get (i ).setY (i * 100 + 100 );
48+ //Repeat --#4.2
4649 }
47- //set some values for all turtles HINT: Use a foreach loop
50+ //Set some values for your turtles HINT: Use a foreach loop --#5.1
4851 for (Turtle turtle : turtles )
4952 {
50- //set the speed of all turtle's to 7
53+ //Set the speed of your turtles to 7 --#5.3
5154 turtle .setSpeed (7 );
52- //have every turtle draw a star of the current size
55+ //Have every turtle draw a star of the current size --#5.4
5356 turtle .drawStar (size );
57+ //Repeat --#5.2
5458 }
5559 }
5660 public static void main (String [] args )
0 commit comments