A shop will give discount of 10% if the cost of purchased quantity is more than 1000.
Ask the user for the quantity. Suppose, one unit will cost 100.
Judge and print total cost for user. Ask for name phone number as well as bill amount
const bill_maker = () => {
const bill_format = {
name_customer: prompt("Enter the customer's name"),
phone_number: Number(prompt("Enter the customer's phone number")),
total_bill_amount: Number(prompt("Enter the bill amount"))
}
// Conditions
if (bill_format.total_bill_amount > 1000) {
return (`${bill_format.total_bill_amount}.Oh! You have 10% discount so you have to pay:` (bill_format.total_bill_amount / 1000) * 100)
} else {
return `${bill_format.total_bill_amount}. You have to pay`
`${bill_format.name_customer} Do visit us again!`
}
}
console.log(bill_maker())