View Single Post
  #4 (permalink)  
Old April 20th, 2011, 10:01 AM
Ruediger Ruediger is offline
Registered User
 
Join Date: Apr 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default strange errors here

I put it right before the statement Tax t= new Tax
this seems to be ok - BUT! the line
String state = args[l];
produces an error and I don't have an idea why
EM 'cannot be resolved to a variable


class TestTax{
public static void main(String[] args){

if (args.length != 3) {
System.out.println("das war noch nichts");
System.exit(0);
}
double grossIncome = Double.parseDouble(args[0]);
String state = args[l];
int dependents = Integer.parseInt(args[2]);


Tax t = new Tax(grossIncome, state, dependents);

double yourTax = t.calcTax();
//calculating tax

double youreTax = t.calceTax();
//calculating tax

// Printing the result
System.out.println("Your tax is " +
yourTax + "$ = " + youreTax + "€") ;


Tax t2 = new Tax(65000, 4);

double hisTax = t2.calcTax();
double hiseTax = t2.calceTax();
// Printing the result
System.out.println("Your tax is " +
hisTax + "$ = " + hiseTax + "€") ;

}
}
Reply With Quote