Results 1 to 3 of 3
Thread: error in code
- 12-06-2007, 10:06 PM #1
Member
- Join Date
- Nov 2007
- Posts
- 38
- Rep Power
- 0
error in code
The deposit command allows a user to deposit money into an existing account.
The cashier must ask for the email address of the account, the password and the
amount to be deposited. If the password is correct, the money will be deposited into
the account. If the deposit could not be completed, the cashier prints out a message
informing the user. If the deposit is completed successfully, the cashier responds
with “Thank you for using the bank”.
it doesn't come up with the print messages whilst testing itJava Code:private void makeDeposit(InputReader reader) { String email = reader.getText("enter email address: "); String password = reader.getText("enter password: "); int amount = reader.getNumber("enter deposit amount: "); if(accounts.containsKey(email)) { Account account = (Account)accounts.get(email); if(account.getPassword().equals(password)) { boolean success = account.deposit(amount); if(success) System.out.println("Thank you for using the bank"); else System.out.println("Unable to deposit to your account"); } } }
can anyone see where its gone wrong?
thanks.
- 12-06-2007, 11:07 PM #2
If neither the 'thank you' nor 'unable to deposit' String are printing then it has to be something with the other two ifs. Double check that you are entering valid email and password data.
- 12-06-2007, 11:40 PM #3
Senior Member
- Join Date
- Nov 2007
- Location
- Newport, WA
- Posts
- 141
- Rep Power
- 0
Similar Threads
-
Help with code (static error)
By oceansdepth in forum New To JavaReplies: 1Last Post: 03-28-2008, 04:32 AM -
I need help fixing my code.. or non code?
By MrHuggykins in forum New To JavaReplies: 1Last Post: 03-19-2008, 10:12 PM -
Pls help with a code error.
By saytri in forum New To JavaReplies: 8Last Post: 12-24-2007, 08:10 PM -
error stack when I try to execute my code
By paty in forum New To JavaReplies: 1Last Post: 08-02-2007, 08:32 PM -
Generating Code Automatically Using Custom code Template In Eclipse
By JavaForums in forum EclipseReplies: 1Last Post: 04-26-2007, 03:52 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks