r/shittyprogramming • u/3beer1919 • Nov 02 '18
Java banking system project
Hello everyone, I’m working on a java banking system project and i was wondering what are the possible classes i could use. Note: I’m restricted to 6 classes including inheritance. Thanks
70
Upvotes
View all comments
Show parent comment
0
u/HarryTorry Nov 03 '18
When dealing with money, it's a better practice (in my opinion) to only store the base denomination (cents, pence) and to store the currency alongside it. No more dealing with floats or casting everything as doubles etc. Then converting to a human readable amount such as £3.27 or $4,327.77 or €1.000.002,45. Different countries render currencies differently as well!
Also just realised we are in r/shittyprogramming but I'll leave it like this.