I tried to run it, but nothing turned out. Can someone help?


import gpdraw.DrawingTool;
import gpdraw.SketchPad;

public class KochCurve {
private DrawingTool pen;
private SketchPad paper;

public KochCurve(){
paper = new SketchPad(500,500);
pen = new DrawingTool(paper);
}

public void draw(int level, int length) {

if (level < 1)
pen.forward(length);
else {
draw(level - 1, length / 3);
pen.turnLeft(60);
draw(level - 1, length / 3);
pen.turnRight(120);
draw(level - 1, length / 3);
pen.turnLeft(60);
draw(level - 1, length / 3);
}
}
}
-----------------------------Below is the driver
public class Driver {

public static void main(String[] args) {
KochCurve kc = new KochCurve();
kc.draw(6,300);
}
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.