Kcode.class
package com; import com.*; import java.io.*; public class Kcode { double taxDue; double taxOwed; double taxDeducted = 0.0; EmployeeObject4 employee; public Kcode() { } public Kcode(EmployeeObject4 k) { employee = k; double totalPay = employee.getLastPayToDate(); double grossPay = employee.getGrossPay(); //Total pay to date is used on cumlative basis for calculating pay and on noncumlative for record purposes only. double totalPayToDate = totalPay + grossPay; employee.setNewTotalPay(totalPayToDate); if(employee.getCumulative() == false) { //Uses static PayAdjustment class to return the pay adjustment. double addPay = PayAdjustment.getPayAdjustment(employee.getPAYEcodeNumbers(), employee.getMonthWeek(), employee.getCurrentPeriod()); double TotaltaxablePayToDate = totalPayToDate + addPay;//pay to be taxed double taxToDate = TaxTables.getTax( TotaltaxablePayToDate,employee); employee.setNewTaxToDate(taxToDate);//<<------ //if this is the first pay period of the tax year. double lastTax = employee.getLastTaxToDate(); //Subtract the tax that has already been paid in year to find what is owed. double tempTax = taxToDate - lastTax; //Add to the tax owed the column8 value double taxDue = tempTax + employee.getColumn8();//tax owed + that from col8 //Calculate the regulatory limit this being half of the gross pay for the period. double regulatoryLimit = grossPay/2; //If tempory tax is equal to or greater than the regulatory limit if(taxDue >= regulatoryLimit) { employee.setNewTaxDeducted(regulatoryLimit); //Tax owed is the regulatory Limit and any tax remaining is placed // in newColumn8 to be paid in the next pay period. employee.setNewColumn8(taxDue - regulatoryLimit); } else //Else tax is below regulatory limit tax and owed as normal. { employee.setNewTaxDeducted(taxDue); } } else//Week one month one basis { double addPay = PayAdjustment.getPayAdjustment((employee.getPAYEcodeNumbers()), employee.getMonthWeek(), 1); //TotalTaxablePayTodate is for latest period only. double totalTaxablePayTodate = addPay + grossPay; double taxDue = TaxTables.getTax( totalTaxablePayTodate, employee); //Calculate the regulatory limit this being half of the gross pay for the period. double regulatoryLimit = grossPay/2; //If tempory tax is equal to or greater than the regulatory limit if(taxDue >= regulatoryLimit)//employee. { employee.setNewTaxDeducted(regulatoryLimit);//Tax owed is the regulatory Limit } else //Else tax is below regulatory limit tax and owed as normal. { employee.setNewTaxDeducted(taxDue); } } } }