public void doCredit(String number, double amount) throws BankTransactionException {

    account = associateAccount(number);

    try {
      account.credit(amount);
      repository.persist();
    } catch (NegativeAmountException | FileNotFoundException nae) {
      throw new BankTransactionException(nae);
    }

    try {
      log.userOperationCredDeb("Credit", number, amount);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public void doDebit(String number, double amount) throws BankTransactionException {

    account = associateAccount(number);

    try {
      account.debit(amount);
      repository.persist();
    } catch (NegativeAmountException | InsufficientFundsException | IOException e) {
      throw new BankTransactionException(e);
    }

    try {
      log.userOperationCredDeb("Debit", number, amount);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public void doEarnBonus(String number)
      throws BankTransactionException, IncompatibleAccountException {

    account = associateAccount(number);

    if (account instanceof SpecialAccount) {
      ((SpecialAccount) account).earnBonus();
      try {
        repository.persist();
      } catch (FileNotFoundException e) {
        throw new BankTransactionException(e);
      }
    } else {
      throw new IncompatibleAccountException(number);
    }

    try {
      log.userOperationEarn("Earn Bonus", number);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public void doTransfer(String fromNumber, String toNumber, double amount)
      throws BankTransactionException {
    AbstractAccount fromAccount;
    fromAccount = associateAccount(fromNumber);

    AbstractAccount toAccount;
    toAccount = associateAccount(toNumber);
    ;

    try {
      fromAccount.debit(amount);
      toAccount.credit(amount);
      repository.persist();
    } catch (InsufficientFundsException | NegativeAmountException | IOException e) {
      throw new BankTransactionException(e);
    }

    try {
      log.userOperationTransf(fromNumber, toNumber, amount);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }