SuffixCode.class
package com; import com.*; import com.TaxTables; import java.io.*; import com.PayAdjustment; public class SuffixCode { public SuffixCode() { } public SuffixCode(EmployeeObject4 employee) { double grossPay = employee.getGrossPay(); double totalPay = employee.getLastPayToDate(); double totalPayToDate = totalPay + grossPay;//3 if(employee.getCumulative() == true) { double freePay = PayAdjustment.getPayAdjustment(employee.getPAYEcodeNumbers(), employee.getMonthWeek(), employee.getCurrentPeriod()); //Subtract the free pay from the total pay todate to leave total taxable pay. double totalTaxablePayToDate = totalPayToDate - freePay;//5 //Send the total taxable pay to static method getTax of class TaxTables tax owed to date returned. double taxToDate = TaxTables.getTax( totalTaxablePayToDate, employee); //Any value in Column8 varible is added to tax their will only be a value in column8 if //the code has just changed since the last pay period from k code. taxToDate = taxToDate + employee.getColumn8(); //The total tax now owed is set. employee.setNewTaxToDate(taxToDate); //The last tax to date is subtracted from the current tax owed to leave the tax owed. //The value new tax owed is passed to the employeeObject. employee.setNewTaxDeducted(taxToDate - employee.getLastTaxToDate()); employee.setNewTotalPay(totalPayToDate ); } else { double freePay = PayAdjustment.getPayAdjustment(employee.getPAYEcodeNumbers(), employee.getMonthWeek(), 1); double totalTaxablePay = grossPay - freePay; if (totalTaxablePay < 0) { //Should be blank if less than 0. totalTaxablePay = 0; } double taxDue = TaxTables.getTax(totalTaxablePay,employee); //The newTaxToDate and newTotalPay varible is set this is only required should the tax code change later. employee.setNewTaxToDate(taxDue + employee.getLastTaxToDate()); employee.setNewTotalPay(totalPayToDate ); employee.setNewTaxDeducted(taxDue); } } }