ATM
ID: 3940241 • Letter: A
Question
BANK ATM application program in JAVASCRIPT, that allows the user to manage transaction data. like withdraw,deposit,etc. Make sure it produces tabular feedback to the user. (meaning user should be able to enter a quanity let's say $20 withdrawal and balance of $100, so it's balance will be $80..As well to deposit money and add the balance to that deposit. Finally to show (-) signs if balance is overdraw,,,Program reads input from the user though the web page., any help is appraciate it. thanks
alert('Welcome to myATM!', 'Automatic Teller Machine');
'How much would you like to deposit?'
How much would you like to withdrawal?
Please take your money now..Thanks for your using my ATM,
Program uses two or more JavaScript library objects
Program reads input from the user though the web page,
Program uses two or more JavaScript library objects
One or more of the program’s user-defined methods accept one or more arguments, or returns a value
Problem statement clearly describes the program to be developed, states its benefits, and explains the programming concepts needed to build the program
Explanation / Answer
-- select choice -- deposit withdrawalbalance: $0.0
$(function() { var balance = 0.0, amountInput = $('#amount'), balanceArea = $('#balance'), choiceSelect = $('#choice'), submitBtn = $('#submit'), atmForm = $('#atm'); function do_transaction(action) { var amount = parseFloat(amountInput.val()); if (isNaN(amount) || amount === '') { balanceArea.text('incorrect or wrong '); } else { if(action === 'deposit') { balance += amount; } else if (action === 'withdrawal') { balance -= amount; } balanceArea.text('balance: $'+balance); } } atmForm.submit(function() { var choice = choiceSelect.val(); if (choice === 'deposit') { do_transaction(choice); } else if (choice === 'withdrawal') { do_transaction(choice); } return false; }); amountInput.hide(); submitBtn.hide(); choiceSelect.change(function() { var choice = choiceSelect.val(); if (choice === 'deposit' || choice === 'withdrawal') { amountInput.show().val(''); submitBtn.show(); } else { amountInput.hide().val(''); submitBtn.hide(); } }); });Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.