r/JavaProgramming • u/Lopsided-Stranger-81 • Oct 30 '25
Java OOP Banking System
Hi guys, I made this code as practice, I'm trying to improve but don't know where to start, I'm learning Java for almost 3 months now and I'm wondering how I'm doing, can anyone give some tips?
3
u/d-k-Brazz Oct 30 '25
Any OOP starts from modeling the domain
In banks you have multiple accounts - thousands of them.
Each account has its number/name and an amount value (use Bigdecimal or store amount in cents as Integer for precise calculations)
All transactions in a bank are moving funds from one account to another
Deposit and withdraw operations involve cash money, for these operations you create a “cashier” account, which is supposed to be active - it’s amount is usually negative, and the value reflects amount of cash money the bank possesses at the moment
So as a bank you may have a number of instances of Account:
123 : Alice (passive) - $0
456: Bob (passive) - $0
098: Cashier (active) - $0
Balance (sum of all amounts) - $0
Bob deposits:
Bank.move(098, 123, $1000.00)
Cash -$1000.00
Bob +$1000.00
Balance - 0
Bob sends Alice $470
Bank.move(123, 456, $470.00)
Cash -$1000.00
Bob +$530.00
Alice +$470.00
Balance - 0
Alice withdraws $120
Bank.move(456, 098, $120.00)
Cash -$880.00
Bob +$530.00
Alice +$350.00
Balance - 0
2
u/d-k-Brazz Oct 30 '25
So you need an Account class
Attributes - number, name, type(active/passive), amount
You need a class for handling transactions, receives accounts “from” and “to” and an amount
Result of moving money should be a transaction object - with id, date, purpose, accounts and amount - you need transaction history, aren’t you?
Additionally think of making draft transactions, where accounts aren’t affected until you commit the transaction, but amount should be reserved until you cancel it
1
11
7
u/abcd98712345 Oct 30 '25
not specific to java but conceptually look at martin fowlers money pattern and double-entry ledger accounting systems as far as modeling this domain in a better way
1
u/RSSeiken Oct 30 '25
Can you push it to a github repo? Might be a good moment to learn git too, I like to use git bash, then I don't have to depend on different IDE's.
It's a bit difficult using only screenshots.
1
u/Lopsided-Stranger-81 Oct 30 '25
alright i'll try that, tho i still don't know how to use github.
1
1
1
2
Nov 04 '25
same dude, 3 months learning Java and now making a Bank Management System.
thanks for posting in the mid of my mental breakdown.
1




2
u/Lopsided-Stranger-81 Oct 31 '25
https://github.com/carlojaybacus14-cyber/Java-OOP-Banking-System.git
I made this repository in Github, I'm constantly changing the code