Java Reference
In-Depth Information
Figure 6-5.
6.
Save the source and run the application.
Notice that the
else
statements are executed.
7.
Change the calculation so that the pay rate is 15.50, save and print the source code,
and run the application.
Notice that the appropriate statements are executed when the condition is true.
Tutorial: Tax Calculation—Part I
In Tutorial/c6.Employee:
1.
Create two private class variables of type
double
called taxAmt and taxSal.
2.
Create a new public method called fedTaxCalc that returns the variable taxAmt and
expects 2 parameters: a
double
variable called payRate and an
int
variable
called exemptions.
3.
Based on the taxSal calculation in Figure
6-1
, in the fedTaxCalc method, enter the formula
to calculate the value of taxSal.
4.
Inside the fedTaxCalc method, enter an
if
statement that sets taxAmt to zero if taxSal is less
than or equal to 50 but 100 if taxSal is not less than or equal to 50.