Challenge 01 · Payroll
Two payrolls, one honest estimate.
- Gross pay
- Allocated to paydays
- PAYE per payroll run
- NI per payroll run
- symptom
- Each job has its own rates, night extras, holiday-pay method, overtime and pay dates, and UK tax is worked out per payroll run, cumulatively or week-1. A confident wrong number is worse than none.
- investigation
- Split the calculation into small pure functions in layers: gross pay, then allocation to pay dates, then PAYE and National Insurance per run, with each tax year's data kept separate. Every rule has table-driven tests.
- decision
- Store money as whole pence, label every figure an estimate, and explain a missing figure instead of showing £0. In live use, a floating-point rounding tail made some valid shifts show their pay as “unavailable” in the calendar; it was traced and fixed, with regression tests added.
- result
- Per-payday estimates for weekly, four-weekly and monthly payrolls, for the 2026/27 tax year and NI category A.



