# Sample JavaScript: total after discount

This is intentionally faulty sample code, not production payment logic.

## Expected behavior

`discountPercent` is a discount in percent from 0 to 100, `subtotal` is a non-negative amount in dollars.
The result is rounded to the cent.

```js
function totalAfterDiscount(subtotal, discountPercent) {
  return Math.round(subtotal * (1 - discountPercent) * 100) / 100;
}

console.log(totalAfterDiscount(2000, 10));
```

Actual result of the sample: -18000. Expected: 1800.

## Reference cases

| Subtotal | Discount, % | Expected result |
| ---: | ---: | ---: |
| 2000 | 10 | 1800 |
| 2000 | 0 | 2000 |
| 2000 | 100 | 0 |
| 199.90 | 15 | 169.92 |

Task: reproduce the bug, explain it, make a minimal fix and check these examples.
In a real system, input validation, how money amounts are represented and the rounding rules must be defined separately. That is outside the scope of this exercise.
