public class ATM { Account acc; //作为演示,省略了密码验证 public boolean login(String name) { if (acc != null) throw new IllegalArgumentException("Already logged in!"); acc = new Account(name); return true; }
public void deposit(float amt) { acc.deposit(amt); }
public void withdraw(float amt) throws InsufficientBalanceException { acc.withdraw(amt); }
public float getBalance() { return acc.getBalance(); }