Design a Bank Management System using core Java with the following features and
requirements. The system should simulate the actions of a bank for up to 5 users
Press 1 to Create Account
Press 2 to Deposit Money
Press 3 to Withdraw Money
Press 4 to Check Balance
Press 5 to Exit
• Maximum number of users: 5
• Store users in a static array
• Each user has: Name, Account Number (auto-generated), Balance
• Start with ₹0 balance
• Use throw and throws to handle invalid inputs (e.g., withdraw more than
balance)
• Use finally to print a standard exit message after every transaction
1. BankInterface (Interface)
• Methods:
o void createAccount(String name, double initialDeposit)
o void deposit(double amount)
o void withdraw(double amount) throws Exception
o void displayDetails()
2. User (Abstract Class)
• Fields (Encapsulated with private access and getters/setters):
o String accountHolderName
o int accountNumber
o double balance
o static int userCount = 0
• Constructor:
o Initializes name, account number, and balance
o Increments static user count
• Abstract method:
o void displayDetails()
3. RegularAccount (Extends User, Implements BankInterface)
• Implements:
o createAccount(), deposit(), withdraw(), displayDetails()
• Override withdraw with try-catch for:
o Insufficient balance (throw new Exception)
• Adds: static final double MIN_BALANCE = 1000
4. PremiumAccount (Extends RegularAccount)
• Overridden withdraw():
o Allows withdrawal even below MIN_BALANCE but shows a warning.
• Additional method: getBonus()
5. BankManager
• Responsible for:
o Maintaining an array of User accounts (fixed size: 5)
o Tracking how many users have been added using [Link]
• Handles user input options:
o 1 → Create Account
o 2 → Deposit
o 3 → Withdraw
o 4 → Display Details
o 5 → Exit
• Has a method to fetch user by account number
• Uses polymorphism for handling both Regular and Premium accounts
6. TransactionUtils
• Class with static helper methods (like input validation, printing separator lines)
• Demonstrates static and utility-style design
7. BankAppMain
• Contains main() method
• While loop menu-driven program
• try-catch-finally block used around user interaction
• Input using Scanner
• Uses throws in method signatures where needed (e.g., withdraw())
----- Welcome to OOPS Bank -----
1. Create Account
2. Deposit
3. Withdraw
4. Check Balance
5. Exit.
Enter choice: 2
Enter Account Number: 1001
Enter Amount to Deposit: 2000
Deposit successful. New Balance: ₹7000
Transaction completed.
-----
Enter choice: 3
Enter Account Number: 1001
Enter Amount to Withdraw: 9000
Insufficient balance!
Transaction completed.
-----
Enter choice: 3
Enter Account Number: 1003
Enter Amount to Withdraw: 3000
Withdrawal successful. New Balance: ₹5000
Transaction completed.
-----
Enter choice: 4
Enter Account Number: 1005
Balance for Gokul (1005): ₹6000
Transaction completed.
Enter choice: 5
Thank you for banking with us!