Skip to content

SyedAbd110786/Banking-Management-System-In-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏦 Banking Management System in java

A console-based banking application built in Java using OOP principles, file-based persistence, and a layered architecture with interfaces, services, and file handlers.


📁 Project Structure

MyBank/
├── Main.java
├── Menu/
│   ├── MainMenu.java
│   └── UserMenu.java
├── Model/
│   ├── Account.java
│   └── Transaction.java
├── Service/
│   ├── AuthService.java
│   └── BankService.java
├── Repository/
│   ├── AccountFileRepository.java
│   ├── AuthServiceRepository.java
│   ├── BankServiceRepository.java
│   └── FileManagerRepository.java
├── FileHandler/
│   ├── AccountFileHandler.java
│   ├── HistoryFileHandler.java
│   └── FileManager.java
└── Utils/
    ├── InputHelper.java
    └── Validation.java

✨ Features

  • Register a new bank account with a unique username and 4-digit PIN
  • Login to an existing account with PIN verification
  • Deposit money into your account
  • Withdraw money with minimum amount validation (min: 100)
  • Check Balance anytime
  • Transaction History — every deposit and withdrawal is logged with date, time, and running balance
  • File Persistence — all data is saved to local files (no database required)

🏗️ Architecture Overview

The project follows a layered architecture:

Layer Package Responsibility
Entry Point Main.java Starts the app
Menu Menu/ Handles UI and navigation
Service Service/ Business logic (auth, banking)
Repository Repository/ Interfaces (contracts)
File Handler FileHandler/ Reads/writes files
Model Model/ Data classes (Account, Transaction)
Utils Utils/ Input reading, validation

🔑 How It Works

Registration

  1. User enters a unique username
  2. User sets a 4-digit numeric PIN
  3. A folder is created for the user containing balance.txt and history.txt
  4. User info (username + PIN) is saved in accounts.txt

Login

  1. Username and PIN are read from accounts.txt
  2. On match, the user is taken to the banking menu

File Storage

accounts.txt          ← stores all username,PIN pairs
<username>/
├── balance.txt       ← stores current balance
└── history.txt       ← stores transaction log

Transaction History Format

1: [15-04-2025 10:32:45] | Deposit : 5000 | Balance : 5000
2: [15-04-2025 11:00:12] | WithDraw : 1000 | Balance : 4000

🧩 Key Classes

Account.java

Holds user data in memory: username, PIN, balance, and file paths for balance and history.

AuthService.java

Handles register() and login() logic using AccountFileRepository.

BankService.java

Handles deposit(), withdraw(), checkBalance(), and readHistory() using AccountFileRepository and HistoryFileHandler.

AccountFileHandler.java

Implements AccountFileRepository — creates accounts, loads/saves balance, checks if a user exists, and verifies PIN.

HistoryFileHandler.java

Saves and displays transaction history with timestamps.

FileManager.java

Low-level file utility: writeFile(), readFile(), appendFile().

Validation.java

  • isValidPin(String pin) — must be exactly 4 numeric digits
  • isValidAmount(long amount) — must be greater than 0 and at least 100

InputHelper.java

Wraps Scanner to safely read int, long, and String from the console.


▶️ How to Run

  1. Open the project in IntelliJ IDEA (or any Java IDE)
  2. Make sure the project SDK is set to Java 8 or higher
  3. Run Main.java
  4. Follow the on-screen menu

⚠️ The app creates files and folders in the working directory (usually the project root). Make sure the program has write permissions.


⚙️ Requirements

  • Java 8+
  • IntelliJ IDEA (recommended) or any Java IDE
  • No external libraries or dependencies required

🚧 Known Limitations

  • PINs are stored in plain text in accounts.txt (no encryption)
  • No transfer between accounts feature yet
  • Single-user session only (no concurrent access handling)
  • Transaction.java model exists but generateReceipt() is not yet implemented

🔮 Possible Future Improvements

  • PIN hashing for security
  • Fund transfer between accounts
  • Receipt generation using Transaction.java
  • Admin panel for managing all accounts
  • GUI using Java Swing or JavaFX

👤 Author

Abdullah
Software Engineering student. Passionate about software development, Java programming, and building structured, scalable applications while continuously improving problem-solving and system design skills.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages