-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise_01.html
More file actions
89 lines (86 loc) · 3.25 KB
/
Exercise_01.html
File metadata and controls
89 lines (86 loc) · 3.25 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Airtime Recharge</title>
</head>
<body>
<script>
var value =prompt('select option: \n 1: self \n 2: others \n 3: Data \n 4: Transfer');
value=parseInt(value);
if(value===1){
var amount = prompt('enter amount');
alert('your #'+ amount + ' recharge was succesful');
}
else if(value===2){
var num = prompt('enter phone number');
var option2 = prompt('enter amount');
var ans = confirm('are you sure you want to send #' + option2+ ' recharge to '+ num );
if(ans){
alert('your #'+ option2 + ' recharge was succesfully sent to:' + num);
}
}
else if(value===3){
var bundle = prompt('select data bundle: \n 1: 500MB \n 2: 1GB \n 3: 2GB');
bundle=parseInt(bundle);
if(bundle===1){
var ans = confirm('subscribe to 500MB data bundle?' );
if(ans){
alert('your 500MB data bundle was succesful');
}
}
if(bundle===2){
var ans = confirm('subscribe to 1GB data bundle?' );
if(ans){
alert('your 1GB data bundle was succesful');
}
}
if(bundle===3){
var ans = confirm('subscribe to 3GB data bundle?' );
if(ans){
alert('your 3GB data bundle was succesful');
}
}
}
else if(value===4){
var select = prompt('select option to transfer:\n 1:Airtime \n 2:Data');
select = parseInt(select);
if(select===1){
var num = prompt('enter phone number');
var amount = prompt('enter amount');
var ans = confirm('Transfer #'+ amount +' to' + num + ' ?');
if(ans){
alert('your #'+ amount + ' transfer to ' + num + ' was succesful');
}
}
else if(select===2){
var num = prompt('enter phone number');
var bundle = prompt('select data bundle: 1: 500MB 2: 1GB 3: 2GB');
bundle=parseInt(bundle);
if(bundle===1){
var ans = confirm('Transfer 500MB data bundle to ' + num + ' ?');
if(ans){
alert('your 500MB data bundle transfer to' + num + ' was succesful');
}
}
if(bundle===2){
var ans = confirm('Transfer 1GB data bundle to ' + num + ' ?');
if(ans){
alert('your 1GB data bundle transfer to' + num + ' was succesful');
}
}
if(bundle===3){
var ans = confirm('Transfer 2GB data bundle to ' + num + ' ?');
if(ans){
alert('your 2GB data bundle transfer to' + num + ' was succesful');
}
}
}
}
else{
alert('Invalid input!');
}
</script>
</body>
</html>