-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
40 lines (29 loc) · 758 Bytes
/
app.js
File metadata and controls
40 lines (29 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var request=prompt("What you want to buy: -phone- or -laptop-");
var Quantity=prompt("Enter the required quantity");
var price;
if (request =="phone"){
price=Quantity * 150;
}
if (request =="laptop"){
price=Quantity * 500;
}
var Discount="5%";
if (price>=2000){
var Discount="50%";
}
else if (price>=1500){
var Discount="40%";
}
else if (price>=1000){
var Discount="30%";
}
else if (price>=500){
var Discount="20%";
}
else if (price>=200){
var Discount="10%";
}
document.getElementById("request").innerText=request;
document.getElementById("Quantity").innerText=Quantity;
document.getElementById("price").innerText=price;
document.getElementById("Discount").innerText=Discount;