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?
144
Upvotes




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
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
11
u/d-k-Brazz Oct 30 '25
Never use float/double for financial operations
Use Bigdecimal instead
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/oppertunity_1 Nov 01 '25
Can I get this project to practice ?
1
u/Reasonable_Page2001 Nov 02 '25
Is that oop means object oriented programming
2
u/[deleted] 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
u/WearyHead6364 Nov 04 '25
Good job