public static void main(String[] args)
{
World earth = new World();
Turtle t1 = new Turtle(earth);
t1.penUp();
t1.moveTo(50,50);
t1.penDown();
t1.setPenWidth(5);
t1.drawLetterN(5.0);

t1.penUp();
t1.moveTo(500,400);
t1.penDown();
t1.setPenWidth(3);
t1.drawLetterN(2.0);

t1.penUp();
t1.moveTo(330,50);
t1.penDown();
t1.setPenWidth(15);
t1.drawLetterN(15.0);

t1.penUp();
t1.moveTo(250,240);
t1.penDown();
t1.setPenWidth(8);
t1.drawLetterN(7.0);

t1.penUp();
t1.moveTo(10,350);
t1.penDown();
t1.setPenWidth(10);
t1.drawLetterN(10.0);
}

public void drawLetterN (double scale)
{
System.out.println("drawLetterN was called");
this.setColor(new java.awt.Color(255, 0, 0));
this.turn(180);
this.forward( (int) (100 * scale));
this.turn(180);
this.forward( (int) (100 * scale));
this.setColor(new java.awt.Color(255, 200, 0));
this.turn(135);
this.forward( (int) (100 * scale));
this.setColor(new java.awt.Color(255, 255, 0));
this.turn(225);
this.forward( (int) (100 * scale));
}


}

im getting an error java:71: cannot find symbol
symbol : method drawLetterN(double)
location: class Turtle

what do i do?

Post the codes with the code tags

Also u have given the methods but not the class names so that we could understand to help you. Only gving it would help us understand whether u are instantiating the correct object for the method call... Repost with code tags and complete code

import java.util.*;
import java.awt.*;

/**
* Class that represents a turtle which is similar to a Logo turtle.
* This class inherts from SimpleTurtle and is for students
* to add methods to.
*
* Copyright Georgia Institute of Technology 2004
* @author Barb Ericson ericson@cc.gatech.edu
*/
public class ComputerSciencesProject01 extends SimpleTurtle
{
////////////////// constructors ///////////////////////

/** Constructor that takes the x and y and a picture to
* draw on
* @param x the starting x position
* @param y the starting y position
* @param picture the picture to draw on
*/
public ComputerSciencesProject01 (int x, int y, Picture picture)
{
// let the parent constructor handle it
super(x,y,picture);
}

/** Constructor that takes the x and y and a model
* display to draw it on
* @param x the starting x position
* @param y the starting y position
* @param modelDisplayer the thing that displays the model
*/
public ComputerSciencesProject01 (int x, int y,
ModelDisplay modelDisplayer)
{
// let the parent constructor handle it
super(x,y,modelDisplayer);
}

/** Constructor that takes the model display
* @param modelDisplay the thing that displays the model
*/
public ComputerSciencesProject01 (ModelDisplay modelDisplay)
{
// let the parent constructor handle it
super(modelDisplay);
}

/**
* Constructor that takes a picture to draw on
* @param p the picture to draw on
*/
public ComputerSciencesProject01 (Picture p)
{
// let the parent constructor handle it
super(p);
}

/////////////////// methods ///////////////////////


public static void main(String[] args)
{
World earth = new World();
Turtle t1 = new Turtle(earth);
t1.penUp();
t1.moveTo(50,50);
t1.penDown();
t1.setPenWidth(5);
t1.drawN(5.0);

t1.penUp();
t1.moveTo(500,400);
t1.penDown();
t1.setPenWidth(3);
t1.drawN(2.0);

t1.penUp();
t1.moveTo(330,50);
t1.penDown();
t1.setPenWidth(15);
t1.drawN(15.0);

t1.penUp();
t1.moveTo(250,240);
t1.penDown();
t1.setPenWidth(8);
t1.drawN(7.0);

t1.penUp();
t1.moveTo(10,350);
t1.penDown();
t1.setPenWidth(10);
t1.drawN(10.0);


t1.penUp();
t1.moveTo(110,100);
t1.penDown();
t1.setPenWidth(5);
t1.drawA(5.0);

t1.penUp();
t1.moveTo(528,420);
t1.penDown();
t1.setPenWidth(3);
t1.drawA(2.0);

t1.penUp();
t1.moveTo(500,200);
t1.penDown();
t1.setPenWidth(15);
t1.drawA(15.0);

t1.penUp();
t1.moveTo(330,310);
t1.penDown();
t1.setPenWidth(8);
t1.drawA(7.0);

t1.penUp();
t1.moveTo(130,450);
t1.penDown();
t1.setPenWidth(10);
t1.drawA(10.0);

}
public void drawN (double scale)
{
System.out.println("drawLetterN was called");
this.setColor(new java.awt.Color(255, 0, 0));
this.turn(180);
this.forward( (int) (10 * scale));
this.turn(180);
this.forward( (int) (10 * scale));
this.setColor(new java.awt.Color(255, 200, 0));
this.turn(135);
this.forward( (int) (10 * scale));
this.setColor(new java.awt.Color(255, 255, 0));
this.turn(225);
this.forward( (int) (10 * scale));
}
public void drawA (double scale)
{
this.setColor(new java.awt.Color(0, 255, 0));
this.turn(20);
this.forward( (int) (10 * scale));
this.setColor(new java.awt.Color(0, 0, 255));
this.turn(135);
this.forward( (int) (10 * scale));
this.turn(180);
this.forward( (int) (10 * scale));
this.setColor(new java.awt.Color(255, 0, 255));
this.turn(275);
this.forward( (int) (10 * scale));
}


} // this } is the end of class Turtle, put all new methods before this

i have an error that says: cannot find symbol
symbol : method drawN(double)
location: class Turtle

everywhere in the main method where it says drawA(); or drawN(); theres this error... PLEASE help i cant fix it

Ok the problem is this.... You have an ComputerSciencesProject01 class implement the SimpleTurtle class and the method drawN(double) is in ComputerSciencesProject01 .... But check your turtle class as to whether it has the

method drawN(double)

So this should be the problem. Although you have implemented the method in the ComputerSciencesProject01 class it has not been not been implemented in Turtle class.

Since this tries to search for the method drawN(double) in Turtle class and is not available is the problem

i posted whatever i have in my code so i think the turtle class is within that im not sure =/

i posted whatever i have in my code so i think the turtle class is within that im not sure =/

Are you sure cause your calling a method from another class and such class does not exist in the code you posted
Its most likely to be in another file in the same directory as your ComputerSciencesProject01 file

Edited 4 Years Ago by zeroliken: n/a

May be you got codes from your Institute that is in the same folder as your code is.. May be other files... If so check a file with name Turtle and post the contents

i know what i did... im working in a turtle.java file which is part of the java book classes and i was trying to add methods to that and rename it as the computer science project 01 and it wouldnt so i changed where it said turtle to computer science project 01

i know what i did... im working in a turtle.java file which is part of the java book classes and i was trying to add methods to that and rename it as the computer science project 01 and it wouldnt so i changed where it said turtle to computer science project 01

either change the public class name and filename back to Turtle or rename the line where you initialize the class to ComputerSciencesProject01

Edited 4 Years Ago by zeroliken: n/a

Okay then what you should do is rename the file as

ComputerSciencesProject01.java

and also change the line 66 as

ComputerSciencesProject01 t1 = new ComputerSciencesProject01(earth);
This article has been dead for over six months. Start a new discussion instead.