0% found this document useful (0 votes)
32 views15 pages

? Java ATM Simulation Project Documentation

The document outlines a Java ATM Simulation Project developed by student Daivik Mittal, which replicates essential ATM operations such as login, balance checking, deposits, withdrawals, and fund transfers using Object-Oriented Programming principles. It includes a detailed description of the project's objectives, functional requirements, class design, and sample code, demonstrating a secure and interactive banking environment. The project successfully showcases the application of programming concepts while providing a practical simulation of an ATM system.

Uploaded by

rishabkandoi305
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views15 pages

? Java ATM Simulation Project Documentation

The document outlines a Java ATM Simulation Project developed by student Daivik Mittal, which replicates essential ATM operations such as login, balance checking, deposits, withdrawals, and fund transfers using Object-Oriented Programming principles. It includes a detailed description of the project's objectives, functional requirements, class design, and sample code, demonstrating a secure and interactive banking environment. The project successfully showcases the application of programming concepts while providing a practical simulation of an ATM system.

Uploaded by

rishabkandoi305
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

💻 Java ATM Simulation Project

Documentation

Simulation of ATM Login and Complete ATM Operations in


Project Title
Core Java

Student
Daivik Mittal
Name

Class 10 A

Roll Number 14
1. Introduction 📝
The Automated Teller Machine (ATM) is an indispensable part of modern
banking, allowing customers to perform basic financial transactions without
needing human intervention. This project aims to replicate the core functionality
of an ATM using Core Java. The program simulates a secure, menu-driven
banking environment where a user can log in with a PIN and perform essential
operations like checking balances, depositing, withdrawing, transferring funds,
and updating security details. This simulation demonstrates a practical
application of Object-Oriented Programming (OOP) principles, managing
user input, implementing logical validations, and maintaining state (account
balance and transaction history).
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to Mr. Raman Jha, my Computer
teacher, for his valuable guidance, continuous support, and encouragement
throughout the completion of this project on ATM Machine Simulation. His
insightful suggestions and constant motivation helped me gain a deeper
understanding of the topic and improve the quality of my work.

I am also thankful to my school for providing the resources and learning


environment necessary for completing this project.

Finally, I would like to acknowledge the support of my parents and friends, who
encouraged me and helped me stay focused during the preparation of this
project.

2. Objectives of the Project 🎯


1. OOP Implementation: To implement object-oriented programming
concepts using classes (ATMSystem, ATMMain) and methods to
encapsulate data and behavior.
2. Functional Simulation: To simulate real-life banking operations
accurately, ensuring all transactions (Deposit, Withdraw, Transfer)
correctly update the account balance.
3. Security and Validation: To enforce a secure login process with
limited attempts and implement data validation for all financial
transactions (e.g., checking for sufficient funds during withdrawal).
4. Interactive User Interface: To provide an interactive and error-free
experience through a console-based, menu-driven program utilizing
loops and switch-case statements.
5. Transaction History: To implement a simple mechanism
(miniStatement) to track and display the last few transactions.
3. Functional Requirements (ATM Operations)
After a successful login, display a menu with the following options and perform
each operation:

 1. Check Balance: Display the current account balance.


 2. Deposit Amount: Add a validated amount to the balance.
 3. Withdraw Amount: Deduct a validated amount (must be > 0 and <=
balance).
 4. Mini Statement / Last Transactions: Maintain and display the last 5
transactions.
 5. Change PIN: Verify the old PIN and update to a new 4-digit PIN.
 6. Transfer Money: Transfer a validated amount to a receiver's account
number.
 7. Check Account Details: Display static customer details and current
balance.
 8. Exit: End the program.

4. Suggested Class Design


 Class Name: ATMSystem
o Data Members: pin, balance, name, accountNumber,
accountType, transactions[], transactionCount.
o Member Functions: login(), menu(), checkBalance(),
deposit(), withdraw(), changePIN(),
transferMoney(), miniStatement(),
accountDetails(), addTransaction().
 Class Name: ATMMain
o Member Function: main() method to start the simulation.
5. Program Code
Java
import [Link];

class ATMSystem {
// Data Members / Account Information
int pin = 1234;
double balance = 5000.0; // Initial balance for the simulation
String name = "Daivik Mittal";
String accountNumber = "1234567890";
String accountType = "Savings";

// Mini Statement storage (stores up to the last 5 transactions)


String[] transactions = new String[5];
int transactionCount = 0; // Tracks the number of transactions recorded

// Scanner for user input


Scanner x = new Scanner([Link]);

/**
* Authenticates the user with a 4-digit PIN.
* Allows a maximum of 3 attempts before exiting.
*/
void login() {
int a = 0;
while (a < 3) {
[Link]("Enter your 4-digit PIN: ");
int Pin;
try {
Pin = [Link]();
} catch ([Link] e) {
[Link]("Invalid input! Please enter a
number.");
[Link](); // Consume the invalid input
attempts++;
continue;
}

if (Pin == pin) {
[Link]("Login successful!");
menu();
return; // Exit login() after successful login
}
else {
attempts++;
[Link]("Incorrect PIN! Attempts left: " + (3 -
attempts));
}
}
// Exits after 3 unsuccessful attempts
[Link]("Account locked due to 3 unsuccessful
attempts.");
[Link](0);
}

/**
* Displays the main ATM menu and handles user choice.
* Runs in a loop until the user chooses to Exit.
*/
void menu() {
while (true) {
[Link]("******* ATM MAIN MENU *******");
[Link]("1. Check Balance");
[Link]("2. Deposit Amount");
[Link]("3. Withdraw Amount");
[Link]("4. Mini Statement");
[Link]("5. Change PIN");
[Link]("6. Transfer Money");
[Link]("7. Check Account Details");
[Link]("8. Exit");
[Link]("******************************");
[Link]("Enter your choice: ");

int choice;
try {
choice = [Link]();
} catch ([Link] e) {
[Link]("Invalid choice! Please enter a number
(1-8).");
[Link](); // Consume the invalid input
[Link]();
continue;
}

switch (choice) {
case 1: checkBalance(); break;
case 2: deposit(); break;
case 3: withdraw(); break;
case 4: miniStatement(); break;
case 5: changePIN(); break;
case 6: transferMoney(); break;
case 7: accountDetails(); break;
case 8: [Link]("Thank you for using our ATM!
Have a nice day!");
[Link](0);
default: [Link]("Invalid choice! Try again.");
}
[Link]();
}
}

/**
* Displays the current account balance.
*/
void checkBalance() {
[Link]("Your current balance is: Rs. %.1f%n", balance);
}

/**
* Handles the deposit operation with validation (amount > 0).
*/
void deposit() {
[Link]("Enter amount to deposit: ");
double amount = [Link]();
if (amount > 0) {
balance += amount;

[Link]("Deposit successful! Updated balance: Rs.


%.1f%n", balance);
} else {
[Link]("Invalid amount! Amount must be greater than
0.");
}
}

/**
* Handles the withdrawal operation with validations:
* 1. Amount > 0
* 2. Amount <= available balance
*/
void withdraw() {
[Link]("Enter amount to withdraw: ");
double amount = [Link]();
if (amount <= 0) {
[Link]("Invalid amount! Amount must be greater than
0.");
} else if (amount > balance) {
[Link]("Insufficient balance!");
} else {
balance -= amount;
addTransaction("Withdrawn: Rs. " + amount);
[Link]("Withdrawal successful! Updated balance: Rs.
%.1f%n", balance);
}
}

/**
* Allows the user to change the PIN after verifying the old PIN.
* New PIN must be a valid 4-digit number and must be confirmed.
*/
void changePIN() {
[Link]("Enter old PIN: ");
int oldPin = [Link]();
if (oldPin == pin) {
[Link]("Enter new PIN: ");
int newPin = [Link]();
[Link]("Confirm new PIN: ");
int confirmPin = [Link]();

// Basic 4-digit PIN validation (1000 to 9999)


if (newPin == confirmPin && newPin >= 1000 && newPin <= 9999) {
pin = newPin;
[Link]("PIN changed successfully!");
} else {
[Link]("PINs do not match or invalid 4-digit
PIN!");
}
} else {
[Link]("Incorrect old PIN!");
}
}

/**
* Handles the transfer of money to another account.
* Validates that the amount is positive and less than or equal to the
balance.
*/
void transferMoney() {
[Link]("Enter receiver account number: ");
String receiverAccount = [Link]();
[Link]("Enter amount to transfer: ");
double amount = [Link]();

if (amount > 0 && amount <= balance) {


balance -= amount;
addTransaction("Transferred: Rs. " + amount + " to Account No.
" + receiverAccount);
[Link]("Successfully transferred Rs. %.1f to Account
No. %s%n", amount, receiverAccount);
} else {
[Link]("Transfer failed! Invalid amount or
Insufficient balance.");
}
}

/**
* Displays the last 5 transactions (Mini Statement).
*/
void miniStatement() {
[Link]("--- MINI STATEMENT ---");
if (transactionCount == 0) {
[Link]("No transactions available.");
} else {
// Display transactions from oldest to newest recorded
for (int i = 0; i < transactionCount; i++) {
[Link](transactions[i]);
}
}
[Link]("----------------------");
}
/**
* Adds a transaction to the history. Implements a circular array logic
* to keep only the last 5 transactions.
*/
void addTransaction(String transaction) {
if (transactionCount < 5) {
// Array not full, add to the next available spot
transactions[transactionCount] = transaction;
transactionCount++;
} else {
// Array is full, shift all elements up by one to make room for
the new one at the end
for (int i = 1; i < 5; i++) {
transactions[i - 1] = transactions[i];
}
transactions[4] = transaction;
}
}

/**
* Displays the account holder's static details.
*/
void accountDetails() {
[Link]("--- ACCOUNT DETAILS ---");
[Link]("Account Holder : " + name);
[Link]("Account Number : " + accountNumber);
[Link]("Account Type : " + accountType);
[Link]("Current Balance: Rs. %.1f%n", balance);
[Link]("-------------------------");
}
}

class ATMMain {
// Main method to execute the ATM simulation
public static void main(String[] args) {
// Create an instance of ATMSystem and start the login process
ATMSystem a = new ATMSystem();
[Link]();
}
}

Sample Output Walkthrough


 1. Login & Check Balance: Demonstrates successful login with PIN 1234 and the
initial balance.
 2. Deposit Amount: Shows a successful deposit and updated balance.
 3. Withdraw Amount: Shows a successful withdrawal and updated balance.
 4. Mini Statement: Displays the last transactions (Deposit and Withdrawal).
 5. Change PIN: Shows changing the PIN from 1234 to 2010.
 6. Transfer Money: Shows a successful fund transfer.
 7. Check Account Details: Displays the final account details and current balance.
 8. Exit: Shows the final exit message.
7. Conclusion ✅
The project successfully created a comprehensive Core Java simulation of an
ATM system. By implementing the ATMSystem class, all functional statement
generation, were met. The use of loops (for continuous operation) and
conditional statements (for validation and flow control) ensured the program's
robustness and adherence to real-world banking logic. This project served as an
excellent exercise in applying OOP concepts and developing a practical,
console-based application that manages data state and user interaction
effectively. The program provides a reliable, interactive demonstration of an
essential financial system component.

Common questions

Powered by AI

The secure login process in the Java ATM simulation ensures security by allowing a maximum of three attempts to enter a 4-digit PIN correctly. The login() method manages user authentication by requesting the PIN from the user, validating it against the stored PIN, and counting each unsuccessful attempt. Upon reaching the third unsuccessful attempt, the account is locked, and the program exits to prevent unauthorized access, thereby protecting user data and privacy .

The ATM simulation code locks a user's account after three unsuccessful login attempts using an incorrect PIN. This is a security measure to prevent unauthorized access to the user's financial information. The consequence of this action is that the program terminates upon the third failed attempt, thereby protecting sensitive information and preventing further attempts to compromise the account .

Switch-case statements in the ATM simulation project are used within the menu() method to facilitate user choices by directing program flow based on user input. When the user selects an option, the switch-case structure accesses the corresponding method (e.g., checkBalance(), deposit()) to execute the chosen operation. This control structure efficiently manages multiple conditions, allowing straightforward mapping of user selections to actions, thus making the program more readable and maintaining logical order in handling various operations .

The Java ATM simulation employs several validation mechanisms to ensure transaction accuracy and security. For withdrawals and transfers, it checks whether the specified amount is positive and does not exceed the balance, preventing overdrawing and erroneous transactions. During PIN changes, the program verifies the old PIN before allowing an update and checks that the new PIN is a valid four-digit number and matches the confirmation provided by the user. These validations are implemented in respective methods like withdraw(), transferMoney(), and changePIN().

The Java ATM simulation project implements Object-Oriented Programming (OOP) principles by using classes and methods to encapsulate data and behavior. Specifically, it uses a class named ATMSystem to hold all account-related data like pin, balance, name, accountNumber, and accountType as private member variables, ensuring data encapsulation. Behavior encapsulation is achieved through member functions such as login(), checkBalance(), deposit(), withdraw(), and more, allowing interactions with the data only through these methods. This encapsulation protects the data and maintains the integrity of operations performed on these data members .

The Java ATM simulation project uses loops and conditional statements to continuously facilitate user interaction and logically control program flow. Loops run continuously to keep displaying the main menu until the user decides to exit, allowing multiple transactions without restarting the program. Conditional statements, such as if-else and switch-case, determine actions based on user inputs and account conditions, such as validating sufficient funds for withdrawal or matching a PIN for authentication. This structure models a real-world banking environment where operations occur seamlessly through repeated interaction and logical decision-making .

The addTransaction method is crucial in the ATM simulation project for recording and managing transaction history. It maintains a circular array to keep track of the last five transactions performed by the user, thereby implementing a mini-statement feature. This method appends new transactions to the array, and if the array is full, it shifts existing transactions to accommodate the latest entry, ensuring that the user always has access to the most recent transactions. This function enables users to review their recent account activity easily and ensures efficient data management .

The mini-statement feature in the Java ATM simulation uses an array to store transaction history, with a size limit of five to maintain up to the last five transactions. It employs a circular array logic to manage this history. When a new transaction occurs and the array is full, older transactions are removed by shifting existing entries upward, making room for the most recent transaction. This approach ensures that only the last five transactions are retained, maintaining an up-to-date transaction history .

The ATM simulation project handles invalid input during user interactions by using try-catch blocks to capture exceptions such as java.util.InputMismatchException. When an invalid entry is detected, the program prompts the user for a correct input type, such as entering numbers for menu choices. This error handling prevents crashes from incorrect data types and enhances user experience by guiding the user to provide valid input. Continuous loops replace invalid attempts, allowing uninterrupted interaction and ensuring that users provide acceptable inputs .

The core functional requirements of the ATM simulation include checking balance, depositing and withdrawing amounts, maintaining a mini-statement, changing PIN, transferring money, and checking account details. Each requirement translates into a practical operation in the simulation by providing a method that processes user inputs and updates the account state accordingly. For instance, the checkBalance() method displays the current balance, deposit() updates the balance by adding a specified amount, and miniStatement() shows up to the last five transactions. These operations ensure the software mimics real-world ATM functionalities .

You might also like