// Tu24.java import ch.aplu.turtle.*; import java.awt.Color; // ------------ class RedTurtleComp ---------------- class RedTurtleComp // for Online Editor in same file // and non-public { private Turtle t = new Turtle(); public RedTurtleComp() { t.setColor(Color.red); t.setPenColor(Color.red); t.setFillColor(Color.red); } public void stern() { for (int i = 0; i < 6; i++) { for (int k = 0; k < 2; k++) { t.forward(50); t.right(140); } t.right(140); } } public void forward(double step) { t.forward(step); } public void hideTurtle() { t.hideTurtle(); } public void fill(double x, double y) { t.fill(x, y); } public double fX() { return t.getX(); } public double fY() { return t.getY(); } } // ------------ Application class ------------ public class Tu24 { public Tu24() { RedTurtleComp t = new RedTurtleComp(); t.forward(60); t.stern(); t.fill(t.fX() + 10, t.fY() + 10); t.hideTurtle(); } public static void main(String[] args) { new Tu24(); } }