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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started