please help me in this question which in the attachment above ↗↗
Answers
Hi,
var purchaseAmount = parseInt(prompt("Enter purchase amount:"));
var discountPercent = 0;
var discountMoney = 0;
var netAmount = 0;
if (purchaseAmount <= 5000) {
discount = 2;
discountMoney = (purchaseAmount / 100) * discount;
netAmount = purchaseAmount - discountMoney;
document.write("Net Amount: " + netAmount);
} else if (purchaseAmount > 5000 && purchaseAmount <= 10000) {
discount = 5;
discountMoney = (purchaseAmount / 100) * discount;
netAmount = purchaseAmount - discountMoney;
document.write("Net Amount: " + netAmount);
} else if (purchaseAmount > 10000) {
discount = 8;
discountMoney = (purchaseAmount / 100) * discount;
netAmount = purchaseAmount - discountMoney;
document.write("Net Amount: " + netAmount);
} else {
document.write("Error: Something went wrong!");
}
Hope it helps.
Hope My Answer Is Correct
String NetAmount = 0, PurchaseAmount = 0, Discount = 0;
DiscountAmount = 0;
If(PurchaseAmount <= 5000)
{
Discount = 2;
}
else if(5000<PurchaseAmount<=10000)
{
Discount = 5;
}
else if(PurchaseAmount>10000)
{
Discount = 8;
}
else
{System.OutPrintLn("Some Error Occurred")}
DiscountAmount = (PurchaseAmount/100) × Discount;
NetAmount = PurchasedAmount - DiscountAmount ;
System.OutPrintLn(NetAmount);