Answer to Question #232806 in HTML/JavaScript Web Application for Munukuntla Swetha

Question #232806
A Hotel is offering discounts to its customers.

Given charge per day dayCharge based on category and number of days customer stayed days as inputs, write a JS arrow function to return the total bill with the discount.
1
Expert's answer
2021-09-03T08:28:50-0400
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));

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS