Compute a discounted total from a base price and a discount percentage.
/**
* Calculates the total price after applying a percentage discount.
*
* @param {number} price — The original (undiscounted) price.
* @param {number} discountPercent — The discount percentage (0–100).
* @return {number} The total after discount.
*
* @example
* // A $100 item with a 20 % discount → $80.00
* calculateTotal(100, 20);
* // → 80
*
* // A $49.99 item with a 15 % discount → $42.49 (rounded)
* calculateTotal(49.99, 15);
* // → 42.4915
*/
function calculateTotal(price, discountPercent) {
return price * (1 - discountPercent / 100);
}