//代码四
public class Account {
private int balance_; // 账户余额
public int getBalance(void) {
return balance_;
}
public void setBalance(int setting) {
balance_ = setting;
}
}
public class CustomerInfo {
private int numAccounts_;
private Account[] accounts_;
public void withdraw(int accountNumber, int amount) {
int temp = accounts_[accountNumber].getBalance();
temp = temp - amount;
accounts_[accountNumber].setBalance(temp);
}
public void deposit(int accountNumber, int amount) {
int temp = accounts_[accountNumber].getBalance();
temp = temp + amount;
accounts_[accountNumber].setBalance(temp);
}
}