-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
56 lines (53 loc) · 1.54 KB
/
index.js
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
let money = document.getElementById(`paisa`);
// paisa = 1000000
let balance = document.getElementById(`balance`);
// initial = 0
let interest = document.getElementById(`interest`);
// initial = 0
let entry = document.getElementById(`entry`);
// input amount
var fd, int;
const pin = 1111;
let enterPin;
function deposit(){
enterPin = prompt(`Enter your pin number: `);
if(enterPin == pin){
if(parseInt(entry.value) > money.innerHTML){
alert(`Invalid Amount!`);
entry.value=``;
}
else{
money.innerHTML = money.innerHTML - entry.value;
fd = parseInt(balance.innerHTML) + parseInt(entry.value);
balance.innerHTML = fd;
entry.value=``;
int = (balance.innerHTML*3)/100;
interest.innerHTML = int;
}
}
else{
alert(`Invalid pin!`);
entry.value=``;
}
}
function withdraw(){
enterPin = prompt(`Enter your pin number: `);
if(enterPin == pin){
if(entry.value > balance.innerHTML){
alert(`Invalid Amount!`);
entry.value=``;
}
else{
fd = parseInt(balance.innerHTML) - entry.value;
balance.innerHTML = fd;
money.innerHTML = parseInt(money.innerHTML) + parseInt(entry.value);
entry.value=``;
int = (balance.innerHTML*3)/100;
interest.innerHTML = int;
}
}
else{
alert(`Invalid Pin!`);
entry.value=``;
}
}