File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,8 @@ class AmortizedMonth implements JsonSerializable
4444 public function __construct (DateTime $ date , float $ principalDue = 0.0 , float $ interestDue = 0.0 )
4545 {
4646 $ this ->date = $ date ;
47- $ this ->principalDue = $ principalDue ;
48- $ this ->interestDue = $ interestDue ;
47+ $ this ->principalDue = round ( $ principalDue, 2 ) ;
48+ $ this ->interestDue = round ( $ interestDue, 2 ) ;
4949 }
5050
5151 public function getTotalAmountDue (): float
@@ -69,9 +69,9 @@ public function setOverpayments(array $overpayments): AmortizedMonth
6969 */
7070 public function getTotalOverpayments (): float
7171 {
72- return array_reduce ($ this ->overpayments , function (float $ carry , Overpayment $ overpayment ) {
72+ return round ( array_reduce ($ this ->overpayments , function (float $ carry , Overpayment $ overpayment ) {
7373 return $ carry + $ overpayment ->getAmount ();
74- }, 0.0 );
74+ }, 0.0 ), 2 ) ;
7575 }
7676
7777 /**
You can’t perform that action at this time.
0 commit comments