Author: Mummana Devi Prasad
Role: Java Developer Intern
The Bank Account Simulation is a console-based Java application designed to replicate core banking operations using Object-Oriented Programming (OOP) principles. It allows users to dynamically create standard or savings bank accounts, perform deposit and withdrawal actions with robust input checks, view real-time balances, and track their entire account ledger via an interactive transaction history.
This project was built to showcase clean coding standards, complete encapsulation, and robust edge-case validation suitable for an internship project submission.
- Account Creation: Interactively set up standard bank accounts or specialized savings accounts.
- Deposit Operations: Add money safely, ensuring only positive numbers are accepted.
- Withdrawal Operations: Withdraw money with strict validation checks. Checks for "Insufficient Balance" and enforces minimum balance requirements for savings accounts.
- Interest Application: Dynamically calculate and credit compound interest to savings accounts.
- Transaction History: Real-time ledger tracking using an
ArrayListto record deposits, withdrawals, interest credits, and failed transaction attempts. - Robust Exception Handling: Menu-driven interface protected from program crashes caused by invalid input formats (e.g., inputting text/letters instead of numbers).
- Language: Java SE 8+
- APIs & Frameworks: Java Standard Library (
java.util.Scanner,java.util.ArrayList) - Tools: VS Code, Terminal (Command Prompt / PowerShell)
- Keep data secure by making account instance variables (
accountNumber,accountHolderName,balance,transactionHistory)private. - Provide access and modifications strictly through controlled public methods (
deposit(),withdraw(),getBalance(),setAccountHolderName()).
- The
SavingsAccountclass inherits standard attributes and features from the baseAccountclass using theextendskeyword.
- Method Overriding: The
SavingsAccountclass overrideswithdraw(double amount)to enforce a minimum balance rule of Rs. 500 and overridesdisplayBalance()to present interest rates. - Polymorphism: In
BankAccountSimulation, the application keeps a reference to the base class typeAccount activeAccountbut executes overridden methods dynamically at runtime (dynamic method dispatch) depending on whether the object instantiated is anAccountorSavingsAccount.
- Constructor Overloading: The
Accountclass defines multiple constructors—one initializing the account with a custom deposit balance, and another initializing with a default0.0balance.
Below is an example session of how the console program functions:
=================================================
WELCOME TO BANK ACCOUNT SIMULATION
=================================================
---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 1
--- Create Account ---
Select Account Type:
1. Standard Account
2. Savings Account (Enforces Rs. 500 Min Balance + Interest)
Enter choice (1-2): 2
Enter Account Number: SAV-100234
Enter Account Holder Name: Mummana Devi Prasad
Enter Initial Deposit: Rs. 1000
Enter annual interest rate (e.g. 3.5 for 3.5%, or press Enter to use default 3.5%): 4.0
Savings Account successfully created!
--- Account Balance ---
Account Number: SAV-100234
Account Holder: Mummana Devi Prasad
Current Balance: Rs. 1000.0
Account Type: Savings Account
Interest Rate: 4.0% per annum
Minimum Balance Required: Rs. 500.0
-----------------------
---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 2
Enter deposit amount: Rs. 500
Successfully deposited Rs. 500.0
---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 3
Enter withdrawal amount: Rs. 1100
Error: Insufficient Balance. A minimum balance of Rs. 500.0 must be maintained.
Current Balance: Rs. 1500.0 | Maximum allowed withdrawal: Rs. 1000.0
---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 3
Enter withdrawal amount: Rs. 800
Successfully withdrew Rs. 800.0 from Savings Account.
---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 6
Successfully applied interest of Rs. 28.0
---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 5
--- Transaction History for Account SAV-100234 ---
1. Account created with initial balance: Rs. 1000.0
2. Deposited: Rs. 500.0 | Current Balance: Rs. 1500.0
3. Failed Withdrawal: Rs. 1100.0 (Enforced Minimum Balance constraint)
4. Withdrew (Savings): Rs. 800.0 | Current Balance: Rs. 700.0
5. Interest Applied (4.0%): Rs. 28.0 | Current Balance: Rs. 728.0
-------------------------------------------------------
---------------- MAIN MENU ----------------
1. Create New Bank Account
2. Deposit Money
3. Withdraw Money
4. Check Balance
5. View Transaction History
6. Apply Interest (Savings Account Only)
7. Exit
Choose an option (1-7): 7
Thank you for using Bank Account Simulation! Goodbye.
- Open your terminal in the directory where the source files are located.
- Compile the classes using
javac:javac Account.java BankAccountSimulation.java
- Run the simulation using
java:java BankAccountSimulation