another "cannot find symbol" error :(

i'm new to programming, and i'm currently trying to make a program that can calculate the area of a pentagon...

right now i'm debugging the code online, since i do not have a program installed on this computer. Anyways, i get this error on line 17...can anybody tell me how to fix it and what it is?

AreaPentagon.java:17: cannot find symbol symbol : variable dataIn location: class AreaPentagon side = dataIn.readLine(); ^ 1 error

import javax.swing.JOptionPane;

publicclass AreaPentagon

{

publicstaticvoid main(String[] args)

{

//declare and construct variables

double side;

double pentagonArea;

double strSide;

//print promts and get input

System.out.println("Area of a Regular Pentagon");

System.out.println("What is the length of a side on the Pentagon");

side = dataIn.readLine();

//calculations

pentagonArea = 1.720477 * Math.pow(side,2);

//output

System.out.print("The Area is: " + pentagonArea);

}

}

[1648 byte] By [jvhuggarda] at [2007-11-27 8:12:17]
# 1
You don't have anything called "dataIn" anywhere in the class. You'll have to declare that first.
DavidKNa at 2007-7-12 19:56:38 > top of Java-index,Java Essentials,Java Programming...
# 2

hey jv,

try to learn how the error is printed...

[File Name]:[Line Number]: [Error Description]

AreaPentagon.java:17: cannot find symbol

and after that for this error...

[What is not found?]: [What is it?] [By what name is it calling?]: location: [Type] [Class Name]

symbol : variable dataIn location: class AreaPentagon

and then the line where the error is happening...

side = dataIn.readLine(); ^ 1 error

now you try to tell me why the error is happing...

regards

i_virus

i_virusa at 2007-7-12 19:56:38 > top of Java-index,Java Essentials,Java Programming...
# 3

ok...it took me about 2 minute but i finally understand what your saying

AreaPentagon.java:17: cannot find symbol

symbol : variable dataIn

location: class AreaPentagon side = dataIn.readLine(); ^ 1 error

i understand the first line....java is saying a symbol is not found and that symbol is a variable and the name of the symbol/variable is dataIn

i did a little bit more research based off what david was saying, and it appears i didn't declare the variable. i figured out, thats because i was going off a previous code and i imported a package i wasnt using ("javax.swing.JOptionPane" instead of "java.io.*")

thank you both for the help!

jvhuggarda at 2007-7-12 19:56:38 > top of Java-index,Java Essentials,Java Programming...
# 4
Which package you import has nothing to do with it. You need to declare a variable before you can use it.
floundera at 2007-7-12 19:56:38 > top of Java-index,Java Essentials,Java Programming...