-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmngapi.html
More file actions
33 lines (32 loc) · 1.18 KB
/
Copy pathmngapi.html
File metadata and controls
33 lines (32 loc) · 1.18 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
<!DOCTYPE html>
<head>
<title> mngapi </title>
<style>
body{
margin-top: 25%;
font: helvetica, 20px, bold;
background-color:whitesmoke;
}
</style>
<script type="text/javascript">
var userInput = prompt ( "How many KES do you wish to send?");
var amount = userInput/1;
var upperLimit = new Array(49,100,500,1000,1500,2500,3500,5000,7500,10000,15000,20000,25000,30000,35000,40000,45000,50000,70000);
tier = 0;
var i = 0;
while (upperLimit[i] < amount ) {(upperLimit[i++]);
tier++;
}
var sendingFees = new Array (1,3,11,15,25,40,55,60,75,85,95,100,110,110,110,110,110,110,110);
var withdrawalFees = new Array (0,10,27,27,27,27,49,66,82,110,159,176,187,187,187,275,275,275,330);
var fee = sendingFees[tier] + withdrawalFees[tier];
var total = fee + amount;
var display = "Transfer Fee: " + sendingFees[tier] + "." + " Agent Withdrawal Fee: " + withdrawalFees[tier] + "." + " Total Fees: " + fee + "." + " You need: " + total + " " + "to send" + " " + amount + " " + "including withdrawal charges ";
alert(display);
document.writeln (display);
</script>
</head>
<body>
<h1> An M-PESA tarriff calculator in HTML 5 and JS </h1>
</body>
</html>