WDV221 Intro Javascript
Team Assignment - Create an ATM
In this project you are going to create an ATM machine using Javascript. You can add amounts and withdraw amounts from your current balance.
Basic Instructions:
1. Create a global variable called accountBalance. Initialize it to 0.
2. The input amount field should follow the following rules:
- The amount cannot be negative. If so, display an error message "Amount cannot be negative.".
3. Create a deposit function that will process a deposit to the account.
- This will add the amount entered in the Amount field to the accountBalance.
- Display the updated balance.
4. Create a withdraw function that will process a withdrawl from the account.
- The amount entered cannot be less than the balance amount. If so, display an error message "Cannot withdraw more than you have!".
- This will subtract the amount entered in the Amount field from the accountBalance.
- Display the updated balance.
5. Create a displayBalance function that will display the current value of accountBalance in the Balance field.
- The balance amount displayed to the page should be formatted as currency.
- Call this function whenever a deposit or withdrawal is processed to display the current balance.
- Call this function from the Balance button.
6. Use the combined operators for the deposit and withdraw processes.
7. Use parseInt( ) or parseFloat( ) as needed.
Intermediate Instructions:
- Use a JavaScript object to store the account information.
- Validate the input amount. It must be a number. If not, display an error message "Please enter a number.".
Advanced Instructions:
- Use the AccountBalance class from the assignments to store the information.
- Captures the transactions. Add a button that will display the transactions on the screen.