I am almost complete but when I compile I get the error \"Method getUserTax in class IncomeTax cannot be applied to given types; required double; found: no arguments; reason: ac
userTax = test.getUserTax();
You need to pass double value as parameter to this call. Your getUserTax method defined as double type parameter required.
public static double getUserTax(double income)
Example:
userTax = test.getUserTax(10.0); //Here 10.0 is just for example.
Just change this method signature: -
public static double getUserTax(double income)
to: -
public static double getUserTax()
You don't need to pass any income parameter, as that you are already having income as instance attribute in IncomeTax class. And when you invoke this method on an IncomeTax instance: -
test.getUserTax();
the income used in the method is nothing but this.income, which references the instance attribute.