commission(sales) computing it correctly — the classic mistake is applying the top rate to the whole amount.commission(120000)
5100.0
1000 + 2500 + 1600: each band pays its own rate.
commission(30000)
600.0
Entirely inside the first band.
Process band by band, subtracting as you go.
min(remaining, band_width) is the amount in each band.