customer.java

来自「用JAVA实现的银行账户系统」· Java 代码 · 共 40 行

JAVA
40
字号
package banking;

public class Customer {

  // Data Attributes
  private String   firstName;
  private String   lastName;
  // Association   Attributes
  //Please define  private array about account;
  private Account account[];
  private int      numberOfAccounts = 0;

  public Customer(String f, String l) {
      firstName = f;
      lastName = l;
      account=new Account[2];
  }

  public String getFirstName() {
      return firstName;
  }
  public String getLastName() {
      return lastName;
  }
  
  
  public void addAccount(Account acct) {
  	  if(numberOfAccounts<10)
  	  account[numberOfAccounts++]=acct; 
  }
  
  public Account getAccount(int account_index) {
  	  return account[account_index];
  }
  
  public int getNumOfAccounts() {
  	  return numberOfAccounts;
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?