Charge the right fee
An invoice tool reads due and paid days and amounts, then reports totals, overdue invoices and fees.
What needs to change
Repair feeFor so every fee matches the days late printed beside it.
Reproduce
- Use go run on the single-invoice sample, then Check work for late and early invoices.
Acceptance criteria
Your review marks · Saved in this browser. Test acceptance is tracked separately.
Notes
The file contains its imports, the Invoice struct, readInvoices, daysLate, lateFee and main.
main prints daysLate(invoice.Due, invoice.Paid) beside the fee.
charge func(int) int accepts a function value. The local adapter supplies its computed day count to that function and returns the resulting charge.