File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help ! Cannot find symbol error

 
G. Graz
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following two .class files that I cna not get the "ttest" variable to pass between the two? Very very new to java and I am going crazy this is not working or file 1 will not compile ? HELP!!!

file 1

import java.util.Scanner;
public class Tax
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);



System.out.print("Please Enter Your Adjusted Gross Income: ");
double agi = in.nextDouble();

System.out.print("Dependents");
double dep = in.nextDouble();

Schedule test = new Schedule (agi,dep,ttst);
System.out.println(test.dduct());

}
}

File 2


public class Schedule
{

private static final double sd1 = 5350;
private static final double sd2 = 3400;


public double agi;
public double dep;
public double ttest ;



public Schedule(double aIncome, double aDepi, double aTest )
{
agi = aIncome;
dep= aDepi;
ttest = aTest;


}

public double dduct()
{
double deduct = 0;

if (dep > 0)
deduct = ((agi - sd1)-(dep*sd2));


return deduct;

}
}
 
G. Graz
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the actual compiler error , sorry !!

java:22: cannot find symbol
symbol : variable ttst
location: class Tax
Schedule test = new Schedule (agi,dep,ttst);
^
1 error

Tool completed with exit code 1
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, there is no variable called 'ttst' in your class Schedule. It's called 'ttest'.

"Cannot find symbol" means that you are using a name (of a variable, class etc.) that the compiler doesn't know. Note that the compiler mentions the line number (22) where the error happens, so look at line 22 in your source code.
[ April 20, 2008: Message edited by: Jesper Young ]
 
K. Tsang
Bartender
Pie
Posts: 3222
12
Android Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either missing another nextDouble() or that third parm in Schedule() constructor is dummy variable (useless)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic