public class MoveBranch extends Branch { /** * Position where to draw at **/ int x,y; /** * Construct a branch with children and * next as null **/ public MoveBranch(int x, int y){ super(); // Call superclass constructor this.x = x; this.y = y; } /** * Accessors **/ public int getXPos() {return this.x;} public int getYPos() {return this.y;} public void moveTo(int x, int y){ this.x = x; this.y = y;} /** * Method to return a string with informaiton * about this branch */ public String toString() { return "Move ("+x+","+y+") "+super.toString(); } /* * Set the location, then draw * @param pen Turtle to draw with **/ public void drawWith(Turtle pen){ pen.moveTo(this.x,this.y); super.drawWith(pen); // Do a normal branch now } }