HELP SIMPLE JAVA CODING TO MAKE A WEBPAGE THAT MIMICS AN ATM
HELP! SIMPLE JAVA CODING TO MAKE A WEBPAGE THAT MIMICS AN ATM! PLEASE PLEASE HELP! HAVE TO DO SOMETHING SIMILAR FOR AN EXAM TOMORROW! I have also posted a \"programming strategy\", but if you know what you\'re doing you won\'t need that.
Solution
I have created web design as per your requirement and also try to add some functionality related to ATM machine .
Please check the following code snippet:-
atm.html
<html>
<head>
<script scr= \"atm.js\"></script>
</head>
<body>
<table border>
<tr>
<td>
<input type=\"text\" id=\"amount\" style=\"background-color:yellow;\">
</td>
</tr>
<tr>
</td>
<tr><tr><td>
<button onclick=\"AddToField(1);\">1</button>
<button onclick=\"AddToField(2);\">2</button>
<button onclick=\"AddToField(3);\">3</button>
<input type=\"button\" id = \"button_withdrawal enter\" value =\"withdrawal\" onClick=\"enterAmount()\" style=\"background-color:black;color:white\">
</td>
</tr>
<tr><td>
<button onclick=\"AddToField(4);\">4</button>
<button onclick=\"AddToField(5);\">5</button>
<button onclick=\"AddToField(6);\">6</button>
<input type=\"button\" id = \"button_deposit\" value =\"Deposit\" style=\"background-color:blue;color:white\">
</td></tr>
<tr><td>
<button onclick=\"AddToField(7);\">7</button>
<button onclick=\"AddToField(8);\">8</button>
<button onclick=\"AddToField(9);\">9</button>
<button style=\"background-color:green;color:white\" onclick=\"clearff();\">Retype</button>
</td></tr>
<tr><td>
<input type=\"button\" id = \"entered_number\" value =\" \">
<button onclick=\"AddToField(0);\">0</button>
<input type=\"button\" id = \"entered_number\" value =\" \">
<input type=\"button\" id = \"button_end\" value =\"End\" style=\"background-color:red;color:white\" onclick= \"end();\">
</td></tr>
</td>
</tr>
</table>
</body>
</html>
amt.js
function withdrawlMoney(amount){
var balance = 2000;
if(amount % 5 != 0){
alert(\'Incorrect Withdrawal Amount (not multiple of 5)\');
return false;
}else if(amount >= balance){
alert(\'Insufficient Funds\');
return false;
}
balance = balance - amount - 0.50;
alert(\'Successful Transaction! \ Available Balance is: Rs \'+balance);
}
function enterAmount(){
var amount = document.getElementById(\"amount\").value;
withdrawlMoney(amount);
}
function AddToField(c) {
document.getElementById(\'amount\').value += c;
};
function clearff() {
document.getElementById(\'amount\').value = \"\";
};
function end() {
window.close();
};
document.getElementById(\"enter\").addEventListener(\"click\", enterAmount);



