You are to program a virtual ATM machine.The client wants Java GUI for its virtu
ID: 3575403 • Letter: Y
Question
You are to program a virtual ATM machine.The client wants Java GUI for its virtual ATM.
The program will allow a user to enter their personal pin number (only 4 numbers allowed from 0100 to 8888). The user then must choose which account they would like to make a transaction: Savings Account or Checking Account, or Loan Payment (such as a mortgage, a car loan, or a student loan). If the user chooses a savings account, then the allowed transactions are either to add money to the saving account, or to withdraw money from the savings account. A balance must be given to the user at the end of the transaction. Assume that the user has a starting balance of $3000 in each of their checking and savings accounts. Error trapping: if a balance goes below $500, then an alert to the user will be issued. For the loan payments, the user is to choose whether the loan is for a mortgage, a student loan, an auto loan, or a personal loan.
For Mortgage: assume $250,000 balance and payment of $2000 per month; For Student Loan: assume $55,000 balance and payment of $200 per month; For Auto Loan, assume $45,000 balance and payment of $500 per month; For Personal Loan, assume $4,000 and payment of $1000 per month.
Test data: for savings account in order: deposit $1000, deposit $500, withdraw $2000, final balance.
Test data for checking account in order: checks (in order) made in the amount of $112, $30, $680, $150, $1000, final balance.
Test data for loan payment(s): see above and provide for at least two payments.
Please answer ASAP! Thank you!!!
Explanation / Answer
<html>
<head>
<script>
function verify()
{
var pin = prompt("Enter your ATM PIN");
if(pin != "Pass@123")
{
alert("Invalid pin. Please try again!");
verify();
}
alert("Authenticated!");
document.getElementById("bal").innerHTML = "100";
}
function diposit()
{
var amount = prompt("How much would you like to deposit?");
if(amount <= 0)
alert("Invalid amount. Please try again!");
else
{
alert("Transaction successful. ");
document.getElementById("msg").innerHTML = "$" + amount + " successfully diposited to your account."
document.getElementById("bal").innerHTML = parseInt(document.getElementById("bal").innerHTML) + parseInt(amount);
}
}
function withdraw()
{
var amount = prompt("How much would you like to withdrawal?");
if(amount <= 0)
alert("Invalid amount. Please try again!");
else
{
alert("Transaction successful. Please take your money now.");
document.getElementById("msg").innerHTML = "$" + amount + " successfully withdrawn from your account.";
document.getElementById("bal").innerHTML = parseInt(document.getElementById("bal").innerHTML) - parseInt(amount);
}
}
</script>
<body>
Message: <span id='msg'></span><br>
Balance $: <span id='bal'></span><br>
<input type="button" value="Diposit" />  
<input type="button" value="Withdraw" />
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.