Thread: error in code
View Single Post
  #1 (permalink)  
Old 12-07-2007, 12:06 AM
dirtycash dirtycash is offline
Member
 
Join Date: Nov 2007
Posts: 36
dirtycash is on a distinguished road
error in code
Quote:

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”.
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"); } } }
it doesn't come up with the print messages whilst testing it
can anyone see where its gone wrong?

thanks.
Reply With Quote
Sponsored Links