import java.util.*; public class BankService { BankAccount account = null; public BankService(BankAccount theAccount) { account = theAccount; //setting the account } public String doService(String answer) { Bank bank = Bank.getInstance(); /* when the user enters the command depsoit * this will deposit the specified into the accountnumber they * want */ if(answer.indexOf("deposit") >=0) { StringTokenizer token = new StringTokenizer(answer); token.nextToken(); String number = token.nextToken(); int num = Integer.parseInt( accNumber ); bank.getAccountByNumber(num); if(check==null); { System.out.println("You have entered an invalid account number); } else { String accNumber = token.nextToken(); int depNum = Integer.parseInt( number ); account.deposit(depNum); } answer = "" + num; } /* when the user enters the command withdraw * this will withdraw the specified from the accountnumber they * want */ else if (answer.indexOf("withdraw")>=0) { StringTokenizer token = new StringTokenizer(answer); token.nextToken(); String number = token.nextToken(); int num = Integer.parseInt( number ); account.withdraw(num); answer = "" + num; } else if (answer.indexOf("balance")>=0) { //is this actually returning the balance of the number the enter? StringTokenizer token = new StringTokenizer(answer); token.nextToken(); String number = token.nextToken(); int num = Integer.parseInt( number ); System.out.println("Your balance is : " + account.getBalance(); } else //if the command entered is invalid return this { answer = "Sorry, I don't understand this request."; } return answer; } }