I have the TestTax class;
Code:
class TestTax {
public static void main (String[] args){
NJTax t = new NJTax();
t.grossIncome= 50000;
t.dependents= 2;
t.state= "NJ";
double yourTax = t.calcTax();
double totalTax = t.adjustForStudents(yourTax);
System.out.println("Your tax is " + yourTax);
}
}
Code:
class tax {
double grossIncome;
String state;
int dependents;
public double calcTax(){
double stateTax = 0;
if(grossIncome < 30000){
stateTax = grossIncome * 0.05;
}
else{
stateTax = grossIncome * 0.06;
}
return stateTax;
}
public void printAnnualTaxReturn(){
// code goes here
}
}
Code:
public class NJTax extends tax{
double adjustForStudents (double stateTax){
double adjustedTax = stateTax - 500;
return adjustedTax;
public double calcTax(){
}
}
}
I am having trouble with the Lesson requirement to:
"Change the functionality of calcTax( ) by overriding it in NJTax. The new version of calcTax( ) should lower the tax by $500 before returning the value."
How is this accomplished. I just have safaribooksonline and no videos for the solution.