// LollipopWorld.java // A kind of TurtleWorld that creates a number // of LollipopTurtles (as specified on the command line) // and, when the run button is pressed, tells each // to draw a lollipop public class LollipopWorld extends TurtleWorld { // instance variable(s) private int numTurtles; private LollipopTurtle[] myTurtles; // constructor public LollipopWorld (int n) { numTurtles = n; myTurtles = new LollipopTurtle[numTurtles]; for (int i = 0; i < numTurtles; i++) { myTurtles[i] = new LollipopTurtle(); } } public void run () { for (int i = 0; i < numTurtles; i++) { myTurtles[i].drawLollipop(); } } public static void main(String[] args) { new LollipopWorld(Integer.parseInt(args[0])); } }