• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help ! Cannot find symbol error

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Either missing another nextDouble() or that third parm in Schedule() constructor is dummy variable (useless)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic