Java Bank Simulator
Overview
The goal of this project is to build a command-line Bank Simulator application that allows users to create accounts, authenticate, manage multiple bank accounts, perform transactions, and review their financial history.
This project is designed for Java developers who understand the fundamentals but need practical experience applying their knowledge to a complete software project.
The goal is not only to make the application work, but to practice building software with proper structure, separation of concerns, and maintainability.
Requirements
The application should simulate a basic banking system.
Users should be able to:
- Create an account
- Login using their identity
- Manage multiple bank accounts
- Deposit funds
- Withdraw funds
- Open a line of credit
- View transaction history
- Persist their data between application runs
Technical Requirements
Language & Build Tools
Required:
- Java 25
- Maven or Gradle
- JDBC
- SQLite database
Data Persistence
The application must persist data using SQLite.
Jackson should be used for serialization/deserialization where appropriate.
The application should store:
- Users
- User profiles/accounts
- Transactions
Database Requirements
The database should contain at minimum:
Users Table
Responsible for authentication data.
Example:
users
-----
id
username
password_hash
created_at
Profiles Table
Represents the user's banking accounts.
A user may have multiple profiles/accounts.
Example:
profiles
--------
id
user_id
account_type
balance
credit_limit
created_at
The profile should contain:
- Current balance
- Account type
- Credit information
- Account metadata
Transactions Table
Stores financial activity.
Example:
transactions
-------------
id
profile_id
transaction_type
amount
timestamp
description
Transactions should be linked to the profile/account, not directly to the user.
Examples:
- Deposit
- Withdrawal
- Credit usage
- Credit repayment
Security Requirements
User authentication should be implemented.
Passwords should never be stored as plain text.
Use a secure password hashing algorithm:
Recommended:
- BCrypt
- Argon2
The application should validate incoming passwords against stored password hashes.
Money Handling
All monetary values should use:
BigDecimal
Do not use:
double
float
Reason: Floating point numbers can introduce rounding errors when dealing with currency.
Suggested Architecture
The following architecture is recommended but not required.
Students should focus on separation of responsibilities.
Example:
bank-simulator
src/main/java
├── controller
│ └── Handles user interaction
│
├── service
│ └── Business logic
│
├── repository
│ └── Database communication
│
├── model
│ └── Entities / data objects
│
├── database
│ └── Connection handling
│
└── utils
└── Helper classes
Possible responsibilities: Controller:
- Receive input
- Display information
Service:
- Deposit logic
- Withdrawal rules
- Account creation
- Validation
Repository:
- Saving data
- Loading data
Model:
- User
- Profile
- Transaction
User Flow
When the application starts:
Display a welcome message.
Example:
Welcome to Java Bank Simulator!
Login
Prompt the user:
Enter your username:
The application should search for an existing user.
Existing User
If the user exists:
Prompt for password.
Validate the password.
If successful:
Display:
Welcome back, username!
Display the account menu.
New User
If the username does not exist:
Ask:
No account found.
Would you like to open a new account? (Y/N)
If no: Exit the application.
If yes: Request:
- Password
- Initial deposit
The initial deposit must be greater than: 0
If valid: Create the user.
Create their first profile/account.
Display:
Your account has been created!
Welcome to Java Bank.
Account Menu
After login:
Display available options:
1. Deposit
2. Withdraw
3. Open Line of Credit
4. View Transaction History
5. Switch Account
6. Exit
Features
Deposit
Users should be able to add money.
Requirements:
- Amount must be positive
- Balance should update
- Transaction should be recorded
Withdraw
Users should be able to remove money.
Requirements:
- Amount must be positive
- Cannot withdraw more than available funds unless credit is available
- Transaction should be recorded
Line of Credit
Users should be able to open a line of credit.
Example:
Credit Limit: $1000
Available Credit: $1000
Requirements:
- Track credit limit
- Track borrowed amount
- Prevent exceeding credit limit
- Record credit transactions
Transaction History
Users should be able to view account history.
Example:
2026-06-16
Deposit
+$500.00
2026-06-17
Withdrawal
-$100.00
Enums
Use enums where appropriate.
Examples:
AccountType
TransactionType
Layered Architecture
Practice separating:
- User interaction
- Business logic
- Data access
JDBC
Students should practice:
- Connecting to databases
- Executing SQL
- Prepared statements
- Mapping results into objects
SQL
Students should learn:
- Creating tables
- Relationships
- Foreign keys
- Queries
- Joins
Interfaces & Dependency Inversion
Practice creating contracts between components.
Example:
TransactionRepository
with implementations:
SQLiteTransactionRepository
Exception Handling
Create meaningful error handling.
Examples:
InvalidAccountException
InsufficientFundsException
AuthenticationException
Collections
Practice using:
- Lists
- Maps
- Sets
Data Serialization
Understand converting between:
Java Objects
↓
JSON
↓
Database Storage
Bonus Challenges
Bonus 1: Automated Tests
Add unit tests using:
- JUnit 5
Test:
- Deposits
- Withdrawals
- Account creation
- Authentication
Bonus 2: Account Transfers
Allow users to transfer money between accounts.
Example:
Checking → Savings
Requirements:
- Validate balance
- Create transaction records
Bonus 3: Interest System
Add interest calculations.
Example: Savings accounts:
0.5% monthly interest
Bonus 4: Admin System
Create an administrator account.
Admin features:
- View users
- Freeze accounts
- View system statistics
Bonus 5: Convert To REST API
Upgrade the application into a Spring Boot API.
Possible endpoints:
POST /users
POST /accounts/deposit
POST /accounts/withdraw
GET /transactions