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:

  • The ATM has infinite funds.
  • The ATM machine can dispense money using the following denominations: $1, $5, $10, $20.

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:

  • There is a smart and dumb way to withdraw money from the ATM and break it into denominations. The smart way involves using division.
  • Use the pre-supplied arrays to test your program.

Project Requirements:

  • Your project shall allow anyone with an existing account number to deposit and withdraw money from their account.
  • Your project shall not allow users to use the ATM if they do not have a valid account number or enter the incorrect pin.
  • Your project shall not allow users to withdraw amounts greater than what they currently have available.
  • Your project shall minimize the number of bills dispensed (start at $20 bills and work your way down from there).
  • The deposit() function shall allow the user to deposit funds into their account.
  • The deposit() function shall return false if the user entered in a dollar amount <= 0 and true otherwise.
  • The withdraw() function shall allow users to withdraw funds from their account.
  • The withdraw() function shall return false if the user enters in a dollar amount <= 0 or the user does not have enough funds in their account. The withdraw function shall return true otherwise.
  • The main() function shall repeatedly prompt the user to withdraw from their account, deposit to their account, print their account balance, and to exit the ATM machine.
  • The main() function shall call the verifyAccount() function to verify the users account number and pin.
  • The main() function shall only call the withdraw(), deposit(), and printBalance() functions if the verifyAccount() function returns true.
  • The main() function shall inform the user whether their withdrawal was successful or unsuccessful.
  • The main() function shall display the amount of each denomination (starting at $20 and going down to $10, 5$ and lastly, $1) that make up the users withdrawal if the withdrawal was successful using the printDenominations() function.
  • The main() function shall inform the user whether their deposit was successful or unsuccessful.

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.

Project Structure

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.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.