A console-based banking application built in Java using OOP principles, file-based persistence, and a layered architecture with interfaces, services, and file handlers.
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
- 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)
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 |
- User enters a unique username
- User sets a 4-digit numeric PIN
- A folder is created for the user containing
balance.txtandhistory.txt - User info (username + PIN) is saved in
accounts.txt
- Username and PIN are read from
accounts.txt - On match, the user is taken to the banking menu
accounts.txt ← stores all username,PIN pairs
<username>/
├── balance.txt ← stores current balance
└── history.txt ← stores transaction log
1: [15-04-2025 10:32:45] | Deposit : 5000 | Balance : 5000
2: [15-04-2025 11:00:12] | WithDraw : 1000 | Balance : 4000
Holds user data in memory: username, PIN, balance, and file paths for balance and history.
Handles register() and login() logic using AccountFileRepository.
Handles deposit(), withdraw(), checkBalance(), and readHistory() using AccountFileRepository and HistoryFileHandler.
Implements AccountFileRepository — creates accounts, loads/saves balance, checks if a user exists, and verifies PIN.
Saves and displays transaction history with timestamps.
Low-level file utility: writeFile(), readFile(), appendFile().
isValidPin(String pin)— must be exactly 4 numeric digitsisValidAmount(long amount)— must be greater than 0 and at least 100
Wraps Scanner to safely read int, long, and String from the console.
- Open the project in IntelliJ IDEA (or any Java IDE)
- Make sure the project SDK is set to Java 8 or higher
- Run
Main.java - 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.
- Java 8+
- IntelliJ IDEA (recommended) or any Java IDE
- No external libraries or dependencies required
- 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.javamodel exists butgenerateReceipt()is not yet implemented
- 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
Abdullah
Software Engineering student. Passionate about software development,
Java programming, and building structured,
scalable applications while continuously
improving problem-solving and system design skills.