findNetIncome() Takes as input the salary and taxes and returns back to the call
ID: 3907351 • Letter: F
Question
findNetIncome() Takes as input the salary and taxes and returns back to the caller the net income (salary minus taxes). NOTE: This method will not be interacting with the user.
displayPayroll() Takes as input hours, salary, taxes and netIncomeand generates to the user the corresponding values. NOTE that the method does not return any values to the caller.
\Users\fi1812bv\workspace\employees.txt <--is where my .txt file is located to go with my assignment.
I need help with the above methods
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 <= 250) { return 0.18 * salary;
}
else if(salary <= 550) { return 0.23 * salary;
}
else if(salary <= 1100) { return 0.28 * salary;
}
else { return 0.33 * salary;
}
}
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 finalSalary -=
findTaxes(finalSalary);
return finalSalary;
}
public static void main(String[] args) {
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 findNetIncome(double salary, double taxes) { return salary - taxes; } public static void displayPayroll(int hours, double salary, double taxes, double netIncome) { System.out.println("Hours worked: " + hours); System.out.println("Salary: " + salary); System.out.println("Taxes: " + taxes); System.out.println("Net Income: " + netIncome); } public static double findTaxes(double salary) { if(salaryRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.