Package calculator

Class PayrollCalculator

java.lang.Object
calculator.PayrollCalculator
All Implemented Interfaces:
Allowance, Payroll, SalaryAdjustment, TaxAndDeductions

public class PayrollCalculator extends Object implements SalaryAdjustment, Allowance, TaxAndDeductions, Payroll
A class representing a payroll calculator that implements salary adjustments, allowances, tax, and deductions. It calculates various components of payroll including overtime pay, salary, contributions, deductions, and net pay. Implements the following interfaces:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    A class to calculate the tax based on the taxable income.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PayrollCalculator(double hoursWorked, double overTimeHours, double hourlyRate)
     
    PayrollCalculator(double hoursWorked, double overTimeHours, double hourlyRate, double riceSubsidy, double phoneAllowance, double clothingAllowance)
    Creates a new instance of the PayrollCalculator class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    A description of the entire Java function.
    double
    Calculate the net pay by subtracting the total deduction from the gross pay.
    double
    Calculates the PagIbig contribution based on the salary.
    double
    Calculate the partial deduction by adding the calculated SSS, PhilHealth, and PagIbig contributions.
    double
    Calculate the PhilHealth contribution based on the salary.
    double
    Calculate the Social Security contribution based on the salary using a predefined table.
    double
    Calculate the total allowances by summing up the rice subsidy, phone allowance, and clothing allowance.
    double
    Calculate the total deduction by summing up the results of partial deduction and withholding tax calculation.
    double
    Calculates the withholding tax based on the gross pay and partial deduction.
    double
    A method to calculate overtime pay.
    double
    Calculate the salary based on the hours worked, hourly rate, and overtime pay.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PayrollCalculator

      public PayrollCalculator(double hoursWorked, double overTimeHours, double hourlyRate, double riceSubsidy, double phoneAllowance, double clothingAllowance)
      Creates a new instance of the PayrollCalculator class.
      Parameters:
      hoursWorked - the number of hours worked by the employee
      overTimeHours - the number of overtime hours of the employee
      hourlyRate - the hourly rate of the employee
      riceSubsidy - the rice subsidy of the employee
      phoneAllowance - the phone allowance of the employee
      clothingAllowance - the clothing allowance of the employee
    • PayrollCalculator

      public PayrollCalculator(double hoursWorked, double overTimeHours, double hourlyRate)
  • Method Details

    • overtimePay

      public double overtimePay()
      A method to calculate overtime pay.
      Specified by:
      overtimePay in interface SalaryAdjustment
      Returns:
      the calculated overtime pay
    • salary

      public double salary()
      Calculate the salary based on the hours worked, hourly rate, and overtime pay.
      Specified by:
      salary in interface SalaryAdjustment
      Returns:
      the calculated salary
    • calculateSSS

      public double calculateSSS()
      Calculate the Social Security contribution based on the salary using a predefined table.
      Specified by:
      calculateSSS in interface TaxAndDeductions
      Returns:
      the Social Security contribution amount
    • calculatePhilHealth

      public double calculatePhilHealth()
      Calculate the PhilHealth contribution based on the salary.
      Specified by:
      calculatePhilHealth in interface TaxAndDeductions
      Returns:
      the calculated PhilHealth contribution
    • calculatePagIbig

      public double calculatePagIbig()
      Calculates the PagIbig contribution based on the salary.
      Specified by:
      calculatePagIbig in interface TaxAndDeductions
      Returns:
      the calculated PagIbig contribution
    • calculatePartialDeduction

      public double calculatePartialDeduction()
      Calculate the partial deduction by adding the calculated SSS, PhilHealth, and PagIbig contributions.
      Specified by:
      calculatePartialDeduction in interface TaxAndDeductions
      Returns:
      the total partial deduction
    • calculateTotalDeduction

      public double calculateTotalDeduction()
      Calculate the total deduction by summing up the results of partial deduction and withholding tax calculation.
      Specified by:
      calculateTotalDeduction in interface TaxAndDeductions
      Returns:
      the total deduction amount
    • calculateWithholdingTax

      public double calculateWithholdingTax()
      Calculates the withholding tax based on the gross pay and partial deduction.
      Specified by:
      calculateWithholdingTax in interface Payroll
      Returns:
      the withholding tax amount
    • calculateGrossPay

      public double calculateGrossPay()
      A description of the entire Java function.
      Specified by:
      calculateGrossPay in interface Payroll
      Returns:
      description of return value
    • calculateNetPay

      public double calculateNetPay()
      Calculate the net pay by subtracting the total deduction from the gross pay.
      Specified by:
      calculateNetPay in interface Payroll
      Returns:
      the net pay calculated
    • calculateTotalAllowances

      public double calculateTotalAllowances()
      Calculate the total allowances by summing up the rice subsidy, phone allowance, and clothing allowance.
      Specified by:
      calculateTotalAllowances in interface Allowance
      Returns:
      the total allowances calculated