public void payInterest() {
   for (BankProduct bp : bankProducts) {
     if (bp instanceof Deposit) {
       bp.setCurrentMoney(bp.getCurrentMoney() + (bp.getCurrentMoney() * bp.getYearlyInterest()));
     }
   }
 }
示例#2
0
  private double calculateMonthlyDepositAccumulations() {
    double total = 0;
    for (BankProduct d : bankProducts) {
      total += d.getMonthlyDepositAccumulation();
    }

    return total;
  }
 public double getAllDepositMoney() {
   for (BankProduct bp : bankProducts) {
     if (bp instanceof Deposit) {
       allDepositMoney += bp.getCurrentMoney();
     }
   }
   return allDepositMoney;
 }