Project Description: For those of you that are only familiar with online banking, an ATM or Automated Teller Machine is a machine at a physical bank that lets you withdraw and deposit money from and to your bank account. For this project, you will implement several methods that let a user deposit money, withdraw money and print their account balance. Most ATM machines in real life only dispense currency of a certain denomination. For example, most machines in the United States only dispense $20 bills and consequently, only let users withdraw amounts that are evenly divisible by $20.
For this project, our ATM machine will allow users to enter any positive amount to withdraw. To make your implementation simpler, assume the following are true:
Before a user can interact with their account, you must have them enter their account number and you must have them enter their pin. Users not registered with the system ahead of time should not be allowed to use the machine.
Hints:
Project Requirements:
I highly suggest that you create global arrays in your code for the account balances, account numbers, and pin numbers. You can initialize them with default values. This way you can access them from anywhere and you do not need to provide a way for the user to provide them before you can test your program.
You are free to use any of the functions I provide to you (after you implement them). You are not to use any functions provided by the Java standard library unless I explicitly tell you it is ok. You are not to use any third-party libraries to implement your project. I want to see your own work.
The following list outlines the functions that you need to provide and implement. It is up to you to define how they interact. At a minimum, you must implement these functions:
public static boolean deposit(String acctNumber, int amount);
Deposits amount in the account specified by acctNumber. This function returns false if amount is less than or equal to zero or the account does not exist. Otherwise, this function returns true. This function should increase the account balance by amount.
public static boolean withdraw(String acctNumber, int amount);
Withdraws amount from the account specified by acctNumber. This function returns false if the account does not have enough funds, the account does not exist, or the amount is less than or equal to 0. Otherwise, this function returns true. This function should decrease the account balance by amount.
public static boolean doesAccountExist(String acctNumber);
Checks that the account indicated by acctNumber exists. This function should return true if the account exists and false otherwise.
public static boolean checkPin(String acctNumber, String pin);
Checks the pin for the account specified by acctNumber. This function should return false if the account does not exist or the pin is incorrect. Otherwise, this function should return true.
public static void main(String[] args);
Implements the core functionality of your ATM machine. This is where you stick the code for letting the user interact with your ATM machine.