public class FractalApp
{
// Draw a Pythogorean tree.
public static void main (String[ ] args)
{ FractalTurtle pythagoras;
pythagoras = new FractalTurtle();
pythagoras.move (90, -240);
pythagoras.drawTree (80);
} //======================
}
public class FractalTurtle extends Turtle
{
public void drawTree (double trunk)
{ paint (0, trunk); // go to top of trunk
move (30, 0); // face to the left
if (trunk > 1)
drawTree (trunk * 0.7); // make branches on the left
move (-60, 0); // face to the right
if (trunk > 1)
drawTree (trunk * 0.7); // make branches on the right
move (30, -trunk); // go to bottom of trunk
} //======================
}