BEGIN PayrollSystem
Step 1: Load Input Files
Load EmployeeData into employeeList
Load TaxTable into taxTable
Load TimeCardData into timeCardList
Step 2: Initialize WeeklyPayroll Output File
Create an empty file WeeklyPayroll
Step 3: Loop through each employee and calculate payroll
FOR each employee IN employeeList DO
Initialize variables
employeeName = employee.name
hourlyRate = employee.hourlyRate
totalHours = timeCardList[employee.id].sum() Sum hours worked for the week
overtimeHours = 0
regularHours = 0
regularPay = 0
overtimePay = 0
grossPay = 0
taxesDue = 0
netPay = 0
Step 4: Calculate regular and overtime pay
IF totalHours > 40 THEN
regularHours = 40
overtimeHours = totalHours - 40
overtimePay = overtimeHours * hourlyRate * 1.5
ELSE
regularHours = totalHours
overtimeHours = 0
overtimePay = 0
END IF
Calculate regular pay
regularPay = regularHours * hourlyRate
Step 5: Calculate gross pay
grossPay = regularPay + overtimePay
Step 6: Determine taxes from TaxTable
FOR each taxBracket IN taxTable DO
IF grossPay BETWEEN taxBracket.min AND taxBracket.max THEN
taxesDue = taxBracket.taxAmount
BREAK
END IF
END FOR
Step 7: Calculate net pay
netPay = grossPay - taxesDue
Step 8: Write employee's payroll details to the output file
Write to WeeklyPayroll:
Employee Name: employeeName,
Gross Pay: grossPay,
Taxes Due: taxesDue,
Net Pay: netPay,
Regular Pay: regularPay,
Overtime Pay: overtimePay
END FOR
Step 9: Close the output file
Close WeeklyPayroll
END PayrollSystem