Hey guys, after days of working through this code i believe i have nearly have it right except the transfer amount goes to another account instead of the one selected, i have spent hours trying different methods of getting it to transfer the amount to the designated account by the user. This is what i have so far...
if i add another String to the balance class String balance = atmData.getBalance1(); the correct output comes for that account that has had money transferred to it but it is not right for the other accounts. How do i get the correct balance to show for accounts that have not had their money deducted or increased and vice versa for the accounts that have had money transferred to them?
You aren't programming in an Object Oriented way. Your String should be replace by something like List<Account>. In which Account holds the information about the user, it's balance etc... Also you shouldn't make everything static. Look up what static means and explain to yourself why something should be static. The Reader on line 51 is never closed. Always close your resources properly as it may cause unexpected behaviour if you don't (check out the try with resources from Java 7).
I think that if you make these changes you'll find the error you're looking for.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
I know that it has been designed pretty bad =(, but i know of somebody using a combo box for users to select which account they want to transfer money to and it works perfectly. I assumed it would be very similar to what i am trying to do with a textfield. Would using String mean i would have not make a new class? sorry but I've only just started using java.