Spec department charges that add up to the invoice
Your task
Your Java billing service splits one company's invoice across its departments, in proportion to the seats each department uses. It adds sales tax and charges each department's card separately. An agent will write the split.
Write the spec you would hand the agent.
What you know:
- Java 21, and an invoice arrives as a
BigDecimalsubtotal with a currency code: USD, EUR or JPY - the tax rate is a percentage such as 8.875
- finance's rule: tax is computed once on the invoice subtotal and rounded half up to the smallest unit of the currency
- seats per department are positive whole numbers
- auditors re-run old invoices and must get exactly the same charges
Then, in a few sentences: what does "split the total and add tax" produce that fails an audit?