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

Below is the code written so far, I am having trouble finishing the below in bol

ID: 3908602 • Letter: B

Question

Below is the code written so far, I am having trouble finishing the below in bold.

package assignment2;

import javax.swing.*;

import java.io.*;

import java.util.*;

public class employeeTXT {

public static void QA() throws FileNotFoundException {

}

public static void userInstruct() { // method to inform user of the use of the program.

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, double ratePay, double overtimeRate) { // method to find salary

double finalSalary = 0;

double overPay = 0;

if (hoursWorked > 40)

overPay = overtimeRate * (hoursWorked - 40); //calculating the total pay of overtime

if (overPay > 0) //Checking if over pay 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 double findTaxes(double salary) { // method to find taxes

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 findNetIncome(double salary, double taxes) { // method to find net income.

return salary - taxes;

}

public static double displayPayroll(int hours, double salary, double taxes, double netIncome) { // method to display payroll.

JOptionPane.showMessageDialog(null, String.format

("Hourse worked:" + hours, "Salary:" + salary, "Taxes:"

+ taxes, "Net Income:" + netIncome));

}

public static void displayPayroll(int hours, double payRate, double overtimeRate, double salary, double taxes, double netIncome, double payRoll) { // method to display advanced payroll.

JOptionPane.showMessageDialog(null, String.format

("Hours worked:" + hours, "Pay Rate:" + payRate + "Over Time Rate:" + overtimeRate

+ "Salary:" + salary + "Taxes:" + taxes + "Net Income:" + netIncome));

}

  

public static void writePayroll(int hours, double salary, double taxes, double netIncome, PrintWriter outFile) { // method to write payroll.

try {

PrintWriter pw = new PrintWriter(new File("\Users\fi1812bv\workspace\payroll.txt"));

pw.println("Hourse worked:" + hours + ", Salary:" + salary + ", Taxes:" + taxes + ", Net Income:" + netIncome);

pw.close();

} catch (IOException e) {

System.out.println("Unable to Write into file");

}

}

  

public static void writePayroll(int hours, double ratePay, double overtimeRate, double salary, double taxes, double netIncome, PrintWriter outFile){ // method to write advanced payroll.

try {

PrintWriter pw = new PrintWriter(new File("\Uswers\fi1812bv\workspace\payroll.txt"));

pw.println("Hours worked:" + hours + ", Pay Rate:" + ratePay + ", Overtime Pay Rate:" + overtimeRate + ", Salary:" + salary + ", Taxes:" + taxes + ", Net Income:" + netIncome);

pw.close();

} catch (IOException e) {

System.out.println("Unable to Write into file");

}

}

  

public static void main(String[] args) throws FileNotFoundException{ // method main.

QA();

String firstName, lastName;

Scanner inFile = new Scanner(new FileReader("\Users\fi1812bv\workspace\payroll.txt"));

PrintWriter outFile = new PrintWriter("\Users\fi1812bv\workspace\payroll.txt");

int hoursWorked, numEmployeesToProcessed;

double grossSalary, payRate, overtimeRate, taxes, netIncome, totalSalary=0, totalTaxes=0, payrollChecksTotal=0;

numEmployeesToProcessed = Integer.parseInt(JOptionPane.showInputDialog("How many employees to process?"));

overtimeRate = inFile.nextDouble();

for (int i = 1; i<=numEmployeesToProcessed; i++){

lastName = inFile.next();

firstName = inFile.next();

payRate = inFile.nextDouble();

hoursWorked = inFile.nextInt();

grossSalary = hoursWorked * payRate;

taxes = //YOUR CODE GOES HERE

netIncome = //YOUR CODE GOES HERE

displayPayroll(hoursWorked, grossSalary, taxes, netIncome);

writePayroll(hoursWorked, payRate, overtimeRate, grossSalary, taxes, netIncome, outFile);

outFile.println("----------------------------------------------------------");

totalSalary = //YOUR CODE GOES HERE

totalTaxes = //YOUR CODE GOES HERE

payrollChecksTotal = //YOUR CODE GOES HERE

}

outFile.println("---------");

outFile.println(String.format("Number of Employees Processed: %d", numEmployeesToProcessed));

outFile.println(String.format("Total Payroll: $%.2f", totalSalary));

outFile.println(String.format("Total Taxes: $%.2f", totalTaxes));

outFile.println(String.format("Payroll Checks Total: $%.2f", payrollChecksTotal));

inFile.close();

outFile.close();

  

}

}

Explanation / Answer

If you have any doubts,please give me comment...

// package assignment2;

import javax.swing.*;

import java.io.*;

import java.util.*;

public class employeeTXT {

public static void QA() throws FileNotFoundException {

}

public static void userInstruct() { // method to inform user of the use of the program.

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, double ratePay, double overtimeRate) { // method to find salary

double finalSalary = 0;

double overPay = 0;

if (hoursWorked > 40)

overPay = overtimeRate * (hoursWorked - 40); // calculating the total pay of overtime

if (overPay > 0) // Checking if over pay 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 double findTaxes(double salary) { // method to find taxes

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 findNetIncome(double salary, double taxes) { // method to find net income.

return salary - taxes;

}

public static void displayPayroll(int hours, double salary, double taxes, double netIncome) { // method to display

// payroll.

JOptionPane.showMessageDialog(null, String.format("Hourse worked:" + hours, "Salary:" + salary,

"Taxes:" + taxes, "Net Income:" + netIncome));

}

public static void displayPayroll(int hours, double payRate, double overtimeRate, double salary, double taxes,

double netIncome, double payRoll) { // method to display advanced payroll.

JOptionPane.showMessageDialog(null,

String.format("Hours worked:" + hours, "Pay Rate:" + payRate + "Over Time Rate:" + overtimeRate

+ "Salary:" + salary + "Taxes:" + taxes + "Net Income:" + netIncome));

}

public static void writePayroll(int hours, double salary, double taxes, double netIncome, PrintWriter outFile) {

try {

PrintWriter pw = new PrintWriter(new File("\Users\fi1812bv\workspace\payroll.txt"));

pw.println(

"Hourse worked:" + hours + ", Salary:" + salary + ", Taxes:" + taxes + ", Net Income:" + netIncome);

pw.close();

} catch (IOException e) {

System.out.println("Unable to Write into file");

}

}

public static void writePayroll(int hours, double ratePay, double overtimeRate, double salary, double taxes,

double netIncome, PrintWriter outFile) { // method to write advanced payroll.

try {

PrintWriter pw = new PrintWriter(new File("\Uswers\fi1812bv\workspace\payroll.txt"));

pw.println("Hours worked:" + hours + ", Pay Rate:" + ratePay + ", Overtime Pay Rate:" + overtimeRate

+ ", Salary:" + salary + ", Taxes:" + taxes + ", Net Income:" + netIncome);

pw.close();

} catch (IOException e) {

System.out.println("Unable to Write into file");

}

}

public static void main(String[] args) throws FileNotFoundException { // method main.

QA();

String firstName, lastName;

Scanner inFile = new Scanner(new FileReader("\Users\fi1812bv\workspace\payroll.txt"));

PrintWriter outFile = new PrintWriter("\Users\fi1812bv\workspace\payroll.txt");

int hoursWorked, numEmployeesToProcessed;

double grossSalary, payRate, overtimeRate, taxes, netIncome, totalSalary = 0, totalTaxes = 0,

payrollChecksTotal = 0;

numEmployeesToProcessed = Integer.parseInt(JOptionPane.showInputDialog("How many employees to process?"));

overtimeRate = inFile.nextDouble();

for (int i = 1; i <= numEmployeesToProcessed; i++) {

lastName = inFile.next();

firstName = inFile.next();

payRate = inFile.nextDouble();

hoursWorked = inFile.nextInt();

grossSalary = hoursWorked * payRate;

taxes = findTaxes(grossSalary);

netIncome = findNetIncome(grossSalary, taxes);

displayPayroll(hoursWorked, grossSalary, taxes, netIncome);

writePayroll(hoursWorked, payRate, overtimeRate, grossSalary, taxes, netIncome, outFile);

outFile.println("----------------------------------------------------------");

totalSalary += grossSalary;// YOUR CODE GOES HERE

totalTaxes += taxes;// YOUR CODE GOES HERE

payrollChecksTotal += netIncome;// YOUR CODE GOES HERE

}

outFile.println("---------");

outFile.println(String.format("Number of Employees Processed: %d", numEmployeesToProcessed));

outFile.println(String.format("Total Payroll: $%.2f", totalSalary));

outFile.println(String.format("Total Taxes: $%.2f", totalTaxes));

outFile.println(String.format("Payroll Checks Total: $%.2f", payrollChecksTotal));

inFile.close();

outFile.close();

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote