Ejemplo n.º 1
0
 /**
  * Compute amount accrued on a principal using compound interest.
  * The interest rate is annual.
  * $startDate must be less than or equal to $endDate.
  * 
  * @param double $principal
  * @param double $annualRate
  * @param date $startDate
  * @param date $endDate
  * @return double amount
  */
 public function amountDue($principal, $annualRate, $startDate, $endDate)
 {
     $months = Defaults::countMonths($startDate, $endDate);
     return round($principal * pow(1 + $annualRate / 100, $months / 12), 3);
 }