private decimal shortTermReloanReleaseAmount() { //original formula //decimal reloanBalance = (originalLoan.MonthlyDue - (shortTermReloanMonthlyInterest() - reloan.ReloanFee)) * monthsUnpaid(); decimal balanceDue = originalLoan.MonthlyDue * monthsUnpaid(); decimal reloanInterest = LoanCalculator.Interest(originalLoan.Principal, originalLoan.InterestRate) * monthsUnpaid(); decimal reloanBalance = balanceDue - (reloanInterest - reloan.ReloanFee); return(originalLoan.Principal - originalLoan.ProcessingFee - reloanBalance); //return originalLoan.Principal - originalLoan.ProcessingFee - reloanBalance; }
public static decimal MonthlyDue(Loan.LoanType type, decimal principal, decimal interest, int term = 0, bool nearestTenth = true) { if (type == Loan.LoanType.AmortizedPayment) { return(LoanCalculator.Amortization(principal, term, interest, nearestTenth)); } else if (type == Loan.LoanType.InterestOnlyPayment) { return(LoanCalculator.PayableInterest(principal, interest, nearestTenth)); } throw new ArgumentException("Unsupported loan type"); }
private decimal longTermReloanReleaseAmount() { LoanFactory factory = new LoanFactory(DatabaseFactory.Default); Loan newLoan = factory.Clone(originalLoan); newLoan.InterestRate = originalLoan.InterestRate + 1; decimal newInterest = LoanCalculator.InterestPaymentPart(originalLoan.MonthlyDue, originalLoan.Principal, originalLoan.InterestRate + 1, originalLoan.MonthlyDue); decimal newPrincipal = originalLoan.MonthlyDue - newInterest; return((newPrincipal * originalLoan.MonthsPaid) - originalLoan.ProcessingFee); }
private decimal interestAmount() { if (IsInterestPayment) { return(Amount); } if (Loan == null) { throw new InvalidOperationException("No loan found."); } return(LoanCalculator.InterestPaymentPart(Amount, loan)); }