const calculateHotelBill = (dayCharge, numberDays) => {
let discount = 0;
if (numberDays > 2 && numberDays <= 5) {
discount = 0.05;
} else if (numberDays > 5) {
discount = 0.15;
}
return dayCharge * numberDays - (dayCharge * numberDays * discount)
}
var dayCharge=prompt("")
var numberDays=prompt("")
console.log(calculateHotelBill(dayCharge, numberDays));
Comments
Leave a comment