Skip to content

krushna1406/Banking_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏛 SecureBank — Java Banking System Simulation

A beginner-friendly, fully-featured banking system built with Java.
Covers OOP, Collections, Swing GUI, Exception Handling, File I/O, Inheritance & Polymorphism.


📁 Project Structure

BankingSystem/
└── src/
    └── banking/
        ├── model/
        │   ├── Customer.java          # Customer entity (name, email, hashed PIN)
        │   ├── Account.java           # Abstract base class for all account types
        │   ├── SavingsAccount.java    # Savings: min balance ₹500, 4% interest
        │   ├── CurrentAccount.java    # Current: no min balance, optional overdraft
        │   └── Transaction.java       # Transaction record (type, amount, timestamp)
        ├── manager/
        │   └── BankManager.java       # Core business logic: create, deposit, withdraw, transfer
        ├── exception/
        │   └── BankingException.java  # Custom runtime exception
        ├── util/
        │   └── FileManager.java       # File I/O: save/load accounts, customers, export logs
        └── gui/
            └── BankDashboard.java     # Swing GUI — light-mode dashboard with 8 panels

✅ Features

Feature Details
Account Creation Savings (min ₹500 deposit) or Current account
Customer Management Full profile: name, email, phone, address, hashed PIN
Deposit Add funds with live balance update
Withdrawal Enforces minimum balance rules
Fund Transfer Between any two active accounts
Transaction Log Timestamped history per account (table view)
Log Export Save transaction history as .txt to bank_data/
Data Persistence Accounts and customers auto-saved via Java Object Serialization
Dashboard Stats Live count of accounts, customers, total balance

🧠 Java Concepts Used

a) OOP Principles

  • Customer — Encapsulates customer data with PIN hashing
  • Account — Abstract class with template for all account types
  • Transaction — Immutable record with enum-based type system
  • BankManager — Orchestrates all banking operations

b) Collections

  • HashMap<String, Account> — Fast account lookup by account number
  • HashMap<String, Customer> — Customer registry keyed by customer ID
  • ArrayList<Transaction> — Per-account transaction history list

c) GUI (Swing)

  • JFrame + CardLayout — Multi-panel navigation
  • JTable + DefaultTableModel — Tabular transaction/account display
  • Custom light-mode palette, hover effects, styled buttons

d) Exception Handling

  • BankingException (custom) — Overdraft prevention, invalid input
  • NumberFormatException — Invalid amount entries caught gracefully
  • All exceptions displayed in the UI as user-friendly error messages

e) File I/O

  • ObjectOutputStream / ObjectInputStream — Binary serialization of Maps
  • PrintWriter / FileWriter — Plain-text transaction log export
  • Auto-creates bank_data/ directory on first run

f) Inheritance & Polymorphism

  • SavingsAccount extends Account — Overrides canWithdraw() to enforce ₹500 minimum
  • CurrentAccount extends Account — Overrides canWithdraw() to support overdraft
  • BankManager works with Account references (polymorphism)

🚀 How to Run

Prerequisites

  • Java JDK 11 or higher installed
  • Any IDE (IntelliJ IDEA, Eclipse, VS Code with Java extensions) or command line

Option A — Command Line

# 1. Navigate to the project folder
cd BankingSystem

# 2. Compile all source files
mkdir -p out
javac -d out $(find src -name "*.java")

# 3. Run the application
java -cp out banking.gui.BankDashboard

Option B — IntelliJ IDEA

  1. Open IntelliJ → File → Open → select BankingSystem/
  2. Mark src as Sources Root (right-click → Mark Directory as → Sources Root)
  3. Open BankDashboard.java and click the ▶ Run button

Option C — Eclipse

  1. File → New → Java Project → uncheck "Use default location" → browse to BankingSystem/
  2. Eclipse auto-detects the source structure
  3. Run BankDashboard.java as Java Application

🖥 Using the Application

Step-by-step Workflow

  1. New Customer → Enter name + PIN → Get Customer ID (e.g. CUST00001)
  2. Open Account → Paste Customer ID → Choose Savings/Current → Enter initial deposit → Get Account Number (e.g. SAV000001)
  3. Deposit → Enter Account Number + Amount → Confirm
  4. Withdrawal → Enter Account Number + Amount (Savings enforces ₹500 minimum)
  5. Transfer → Enter From/To account numbers + Amount
  6. Transactions → Enter Account Number → View full timestamped log → Export as .txt
  7. All Accounts → See a live overview of every account in the system

Data Storage

All data is automatically saved to bank_data/ after every operation:

  • accounts.dat — Serialized account objects
  • customers.dat — Serialized customer objects
  • txn_ACCNO.txt — Exported transaction logs (generated on demand)

📌 Account Rules

Account Type Minimum Balance Withdrawal Rule Extra
Savings ₹500 Balance after withdrawal ≥ ₹500 Supports interest application
Current ₹0 Balance ≥ -overdraftLimit Supports overdraft (default ₹0)

🔐 Security Notes (Beginner Level)

  • PINs are stored as a simple hash (not bcrypt — this is intentional for beginner scope)
  • All inputs are validated before any operation
  • Custom BankingException prevents illegal state (overdraft, inactive accounts)
  • Accounts are marked Active/Inactive (extendable to support account locking)

💡 Possible Extensions

  • Add login screen with PIN authentication
  • Implement interest calculation scheduler
  • Add account closing functionality
  • Use a proper database (SQLite / H2) instead of object serialization
  • Add search/filter to transaction and account tables

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages