hi
my complier showing me that i am having 4 errors.In t1.drawHexagon(int width); & t1.drawPentagon( int width ).Its says .class and ";" expected.
Help.
Thank you
import java.util.*;
import java.awt.*;
public class Turtle extends SimpleTurtle
{
public Turtle (int x, int y, Picture picture)
{
super(x,y,picture);
}
public Turtle (int x, int y,
ModelDisplay modelDisplayer)
{
super(x,y,modelDisplayer);
}
public Turtle (ModelDisplay modelDisplay)
{
super(modelDisplay);
}
public Turtle (Picture p)
{
// let the parent constructor handle it
super(p);
}
/////////////////// methods ///////////////////////
public void drawSquare()
{
this.turnRight();
this.forward(30);
this.turnRight();
this.forward(30);
this.turnRight();
this.forward(30);
this.turnRight();
this.forward(30);
}
public void drawRectangle ( int width , int height )
{
this . turnRight ( ) ;
this . forward ( width ) ;
this . turnRight ( ) ;
this . forward ( height ) ;
this . turnRight ( ) ;
this . forward ( width ) ;
this . turnRight ( ) ;
this . forward ( height ) ;
}
public void drawHexagon ( int width )
{
this . turn ( 30 ) ;
this . forward ( width ) ;
this . turn ( 50 ) ;
this . forward ( width ) ;
this . turn ( 50 ) ;
this . forward ( width ) ;
this . turn ( 50 ) ;
this . forward ( width ) ;
this . turn ( 50 ) ;
this . forward ( width ) ;
this . turn( 50 ) ;
this . forward ( width ) ;
this . turn ( 50 ) ;
}
public void drawPentagon ( int width )
{
this . turn ( 30 ) ;
this . forward ( width ) ;
this . turn ( 60 ) ;
this . forward ( width ) ;
this . turn ( 60 );
this . forward ( width ) ;
this . turn ( 60 ) ;
this . forward ( width ) ;
this . turn ( 60 ) ;
this . forward ( width ) ;
this . turn ( 60 ) ;
}
public void drawTriangle( int width )
{
this.turn();
this.forward(120);
this.turn();
this.forward(120);
this.turn();
}
public static void main(String[] args)
{
World earth = new World();
Turtle t1 = new Turtle(earth);
t1.drawSquare();
t1.drawHexagon(int width);
t1.drawPentagon( int width )
}
}