Business requirement

An electricity provider bills the first 100 units at ₹2, the next 200 at ₹4, and remaining units at ₹7. A surcharge applies to larger bills.

  1. Charge the first 100 units at ₹2 per unit.
  2. Charge units 101–300 at ₹4 per unit.
  3. Charge every unit above 300 at ₹7 per unit.
  4. Add a 5% surcharge when the slab total is above ₹1,500.
  5. Do not accept negative units and show the final amount with two decimals.