Hi all,
As I try to get familiar with the code i am coming across some things that i
am not too sure about. Hopefully some one can comment on these things.
1. Method allDecliningInstallments (specifically lines 2402 to 2424)
I see that the principalPaidCurrentPeriod is calculated twice and added
to the list twice. although it wont affect the functionality because we are
calculating the same thing twice and adding it to the same instance. or am i
missing something and there is a business rule behind this? Can i just
remove the second addition
here is the code snippet:
double principalPaidCurrentPeriod = 0;
for (int i = getGracePeriodDuration(); i <
getNoOfInstallments(); i++) {
installment = new EMIInstallment();
principalPaidCurrentPeriod =
Math.abs(loanInterest
.getAmountDoubleValue()
- interestPerInstallment);
if (principalBalance > 0) {
interestPerInstallment = Math
.abs(principalBalance
*
((getInterestRate().doubleValue() / 100) /
getDecliningInterestAnnualPeriods()));
}
installment.setPrincipal(new Money(Double
.toString(principalPaidCurrentPeriod)));
Money interstPerInstallmentM = new
Money(Double
.toString(interestPerInstallment));
installment.setInterest(interstPerInstallmentM);
principalPaidCurrentPeriod =
Math.abs(loanInterest
.getAmountDoubleValue()
- interestPerInstallment);
installment.setPrincipal(new Money(Double
.toString(principalPaidCurrentPeriod)));
principalBalance = principalBalance
-
principalPaidCurrentPeriod;
emiInstallments.add(installment);
}
return emiInstallments;
2. Method applyRounding()
I am not sure what business rule this method is implementing. It seems
that the rounding of the amount (interest, principal based on configuration
) is handled in money.
Furthermore the first thing it evalutes is
if (!isPricipalZeroInAnyInstallmemt()) {
This means that if a Loan product has principal only grace (for 1 or more
installments, which will make the princial 0 for the grace installments)
this code will not be executed. Does this seem correct?
Thanks
Soham
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/