| | |
Kochcurve code is not working?
Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
![]() |
•
•
Join Date: Dec 2008
Posts: 2
Reputation:
Solved Threads: 0
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);
}
}
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);
}
}
![]() |
Other Threads in the Computer Science Forum
- Previous Thread: Weight Conversion Storage
- Next Thread: Algorithim Verification
| Thread Tools | Search this Thread |
Tag cloud for Computer Science
ai algorithm algorithms amazon assignment assignmenthelp assignments automata battery bigbrother binary bittorrent bizarre bletchleypark blogging business cern clueless compiler computer computers computerscience computertrackingsoftware connect conversion csc data dataanalysis development dfa dissertation dissertations dissertationthesis dissertationtopic ebook employment energy floatingpoint foreclosuresoftware fuel gadgets geeks givemetehcodez government graphics hardware history homework homeworkassignment humor ibm idea ideas internet iphone ipod itcontracts jobs kindle laser laws lazy lsmeans marketing mining mobileapplication msaccess netbeans networking news os p2p parser piracy principles programming rasterizer research science security sex simulation software spoonfeeding spying student study supercomputing sweden syntactic technology textfield tree turing turingtest two'scompliment uk virus warehouse ww2






