/**
 * Class that extends BankAccount to model a checking account.
 *   @author Dave Reed
 *   @version 1/10/17
 */
public class CheckingAccount extends BankAccount {
  private int transactionCount;
  private static final int NUM_FREE = 3;
  private static final double TRANS_FEE = 2.0;

  public CheckingAccount() {
    this.transactionCount = 0;
  }

  public void deposit(double amount) {
    super.deposit(amount);
    this.transactionCount++;
  }
	
  public void withdraw(double amount) {
    super.withdraw(amount);
    this.transactionCount++;
  }
	
  public void deductFees() {
    if (this.transactionCount > CheckingAccount.NUM_FREE) {
      double fees = 
          CheckingAccount.TRANS_FEE * 
           (this.transactionCount-CheckingAccount.NUM_FREE);
      super.withdraw(fees);
    }
    this.transactionCount = 0;
  }
}
