import java.util.*; import java.io.*; public class banking{ public static void main(String[] args) throws IOException{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String line = null; banking b = new banking(); boolean countSet = false; while((line = reader.readLine())!=null){ if(!countSet){ int count = Integer.parseInt(line); if(count==0){ System.out.println("goodbye"); break; } for(int i=0;i accounts = new ArrayList(); public banking(){ } public String addZero(double number){ String text = number+""; StringTokenizer t = new StringTokenizer(text, "."); String pred = (String)t.nextElement(); String za = (String)t.nextElement(); if(za.length()==1){ za += "0"; } return pred+"."+za; } public String getBankNumber(String number){ StringTokenizer t = new StringTokenizer(number, "/"); t.nextElement(); String elem = (String)t.nextElement(); return elem; } public void transfer(String source, String dest, double balance){ if(source.equals(dest)){ System.out.println("transfer "+addZero(balance)+": same account"); return; } Account sourceAccount = findAccount(source); Account destAccount = findAccount(dest); if(sourceAccount!=null && destAccount!=null){ if(sourceAccount.balance>=balance){ sourceAccount.balance -= balance; destAccount.balance += balance; String sourceBank = getBankNumber(sourceAccount.number); String destBank = getBankNumber(destAccount.number); if(sourceBank.equals(destBank)){ System.out.println("transfer "+addZero(balance)+": ok"); } else { System.out.println("transfer "+addZero(balance)+": interbank"); } } else { System.out.println("transfer "+addZero(balance)+": insufficient funds"); } } else { System.out.println("transfer "+addZero(balance)+": no such account"); } } public void withdraw(String number, double balance){ Account a = null; if((a = findAccount(number))!=null){ if(a.balance>=balance){ a.balance -= balance; System.out.println("withdraw "+addZero(balance)+": ok"); } else { System.out.println("withdraw "+addZero(balance)+": insufficient funds"); } } else { System.out.println("withdraw "+addZero(balance)+": no such account"); } } public void deposit(String number, double balance){ Account a = null; if((a = findAccount(number))!=null){ a.balance += balance; System.out.println("deposit "+addZero(balance)+": ok"); } else { System.out.println("deposit "+addZero(balance)+": no such account"); } } public void create(String number, double balance, boolean showMessage){ if(findAccount(number)==null){ Account newAccount = new Account(); newAccount.number = number; newAccount.balance = balance; accounts.add(newAccount); if(showMessage){ System.out.println("create: ok"); } } else { System.out.println("create: already exists"); } } public Account findAccount(String number){ for(int i=0;i