I have been staring at my code for too many hours and I can't figure
out this last problem with my code. It's an ATM Simulation consisting
of a Client and Server. The source code is availible here:
http://www.hiddentreasurehosting.com/sourcecode/index.html
Just compile it and it will run fine. Make sure you start the Server
first.
You can use javac to compile and then java to run them. Use "java
Server" and "java Application" in that order to get it running.
Now to see the problem it's having, use some of the PIN's hard-coded
in the Bank.java. As you can see, each PIN is associated with an ID.
Once the PIN is validated, the next step is using that ID with the
SetAccount function in the CustomerAccount.java. This uses the ID to
set the values of the account, ie what accounts exist and what
balances are.
Everything seems to be working fine, but there is a bug somewhere.
You'll notice the first PIN, 1234 works perfect. If you try to access
an account that doesn't exist, it says an Error message "No existing
account". But if you use a different PIN, 7777 or the other one 5555,
and try to access an account that shouldn't exist for example PIN 7777
and PIN 5555 shouldn't have moneymarket accounts. But if you try to
access them in the Client program GUI, it doesn't display any error
that no account exists, like it does for the first PIN, 1234.
Once playing around with the program it will be very easy for you to
see what I mean. I'm sure this isn't too difficult of a program to
debug, but my eyes are hurting and I need this worked out ASAP.
Hopefully someone brillant can enlighten me sometime soon. ;) Thanks
for the help. |
Clarification of Question by
wahooka-ga
on
27 Feb 2003 04:54 PST
Yes, I see what you mean. But I deleted my old .class files and the
program seemed to work the first time around. But there is still a
problem. Once you reach the end of your transaction, you have an
option to do another tranasaction, or esstienally logout.
If you choose logout, and re-enter a different pin, then you will get
the error I have described. So the problem still does exist. Thanks
for the suggestion.
|
Clarification of Question by
wahooka-ga
on
27 Feb 2003 17:23 PST
It seems as thought I had accidently had one wrong file compiling in
the same directory. So it does work, thanks alot for helping me find
my problem though.
Another problem I'm having is with adding multi-threading to the atm
client/server. Instead of my answer money going toward the previous
question, someone who can help me figure out how to implement
multi-threading will get the money. I also added a little bit more to
it to make it worth while. I need multi-threading to enable up to 10
clients to connect to the server at the same time, otherwise
displaying a message that the user will have to wait for an open slot,
or cancel everything and not wait.
Same code as the above example. Fast answer will result in a nice tip.
As always, thanks for the help!
|