Question: I need help with writing a method for findTaxes() Will compute and return taxes based on salary according to the following table. NOTE: This method
I need help with writing a method for
findTaxes() Will compute and return taxes based on salary according to the following table. NOTE: This method will not be interacting with the user.
| Tax Bracket - Salary | TaxRate |
|---|---|
| <=$250.00 | 18% |
| <=$550.00 | 23% |
| <=$1100.00 | 28% |
| otherwise | 33% |
This is the code for by program so far.
Thanks in advance.
public class employeeTXT {
public static void userInstruct() {
JOptionPane.showMessageDialog(null, "This program will take a .txt file from AvaCams Inc and allow them an electronic version of their payroll.");
}
public static double findSalary(int hoursWorked, int ratePay, double overtimeRate) {
double finalSalary= 0;
double overPay = 0;
if(hoursWorked>40)
overPay = overtimeRate * (hoursWorked-40); //calculating the total pay of overtime
if(overPay > 0) //Checking if overpay needs to be added in the final salary
finalSalary = (hoursWorked * ratePay) + overPay;
else
finalSalary = (hoursWorked * ratePay); //else the salary will
return finalSalary;
}
public static void main(String [] args) [
userInstruct();
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
