Professional Documents
Culture Documents
Atm
Atm
import java.util.Scanner;
// Other methods for getting user input and interacting with the database
java
import java.util.Scanner;
Explanation:
The ATMSystem class represents the ATM system and contains methods for various
operations.
The start() method is the entry point of the ATM system. It displays the
welcome screen, authenticates the customer, and presents the main menu options.
The displayWelcomeScreen() method displays a welcome message to the user.
The authenticateCustomer() method prompts the user for an account number and
PIN, checks the validity of the credentials, and returns a Customer object if the
authentication is successful.
The displayMainMenu() method displays the main menu options.
The getSelectedOption() method reads the selected option from the user.
The performSelectedOption() method executes the selected option by calling the
corresponding method.
The displayBalance() method retrieves and displays the customer's account
balance.
The withdrawMoney() method prompts the user for the withdrawal amount,
processes the withdrawal, and updates the account balance.
The depositMoney() method prompts the user for the deposit amount, processes
the deposit, and updates the account balance.
The displayGoodbyeMessage() method displays a farewell message to the user.
The displayErrorMessage() method displays an error message when the
authentication fails.
The getAccountNumberFromUser() method reads the account number from the user.
The getPINFromUser() method reads the PIN from the user.
The isValidAccountNumberAndPIN() method checks the account number and PIN
against the database (in this case, hardcoded values are used for simplicity).
The getAccountBalance() method retrieves the account balance from the database
(hardcoded value for simplicity).
The processWithdrawal() method processes the withdrawal transaction, updating
the account balance (simplified implementation based on balance comparison).
The processDeposit() method processes the deposit transaction, updating the
account balance (simplified implementation).
The main() method creates an instance of ATMSystem and starts the ATM system.
////with comments
import java.util.Scanner;
// Other methods for getting user input and interacting with the database