/**
 * Bank Account info:
 * - first name
 * - last name
 * - type of accounts (chequing, savings)
 * - account number
 * - balance
 * - overdraft? address, etc? we abstract the real world and simplify!  
 * 
 * Actions:
 * - withdraw
 * - deposit
 * - get balance
 * - transfer? interest? again we simplify and ignore these.
 */
public class BankAccount {
  
  /** The first name of the bank account owner. */
  private String firstName;
  
  /** The last name of the bank account owner. */
  private String lastName;
  
  /** The type of the bank account. */
  private boolean isChequing;
  
  /** The account balance. */
  private double balance;
    
  /** The account number. */
  private int number;

  /**
   * Create a new bank account with first name f,
   * last name l, account type t, balance b, and
   * account number n.
   */
  public BankAccount(String f, String l, double b, boolean t, int n) {
    this.firstName = f;
    this.lastName = l;
    this.balance = b;
    this.isChequing = t;
    this.number = n;
  }
  
  /**
   * Create a new chequing bank account with first name f,
   * last name l, and account number n. default balance is $20
   */ 
  public BankAccount(String f, String l, int n) {
    this(f, l, 20.0, true, n);
  }

  /**
   * Get the bank account balance.
   */
  public double getBalance() {
    return this.balance;
  }
  
  /** 
   * Withdraw amount d from the bank account.
   */
  public void withdraw(double d) {
    this.balance = this.balance - d;
  }
  
  /**
   * Deposit amount a into the bank account.
   */
  public void deposit(double d) {
    this.balance += d;
  }

  /** 
   * compares this bank account with another one.
   * Two bank accounts considered the same if they
   * have the same account number.
   */
  public boolean isEqual(BankAccount ba2){
    return this.number == ba2.number;
  }

}
