Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with writing a method for findTaxes() Will compute and return taxes

ID: 3906806 • Letter: I

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 will not be interacting with the user.

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();

Tax Bracket - Salary TaxRate <=$250.00 18% <=$550.00 23% <=$1100.00 28% otherwise 33%

Explanation / Answer

import javax.swing.*; 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 findTaxes(double salary) { if(salary