public static void Print(PaymentOverview overview) { Output.WriteLine($"Loan amount: {overview.LoanAmount} kr."); Output.WriteLine($"Loan duration: {overview.LoanDuration} months"); Output.WriteLine($"Monthly payment: {Math.Round(overview.Installment, 2)} kr."); Output.WriteLine($"Total paid amount (without administrative fee): {Math.Round(overview.TotalPaidAmount, 2)} kr."); Output.WriteLine($"Total paid interest: {Math.Round(overview.TotalPaidInterest, 2)} kr."); Output.WriteLine($"Administrative fee (one time): {Math.Round(overview.AdministrationFee, 2)} kr."); }
public PaymentOverviewModel Convert(PaymentOverview entity) => entity != null ? new PaymentOverviewModel { ActualAnnualInterestRate = entity.ActualAnnualInterestRate, MonthlyCost = entity.MonthlyCost, TotalAdminFees = entity.TotalAdminFees, TotalInterest = entity.TotalInterest } : null;
public PaymentOverview CreateOverview(double amount, int duration, Term term) { var overview = new PaymentOverview(term) { LoanAmount = amount, LoanDuration = duration }; overview.Installment = CalculateInstallment(overview.LoanAmount, overview.LoanDuration, term); overview.TotalPaidAmount = CalculateTotalAmount(overview.Installment, overview.LoanDuration); overview.AdministrationFee = CalculateAdministrationFee(term, overview.LoanAmount); overview.TotalPaidInterest = CalculateTotalPaidInterest(overview.TotalPaidAmount, overview.LoanAmount); _historyRepository.Insert(overview); return(overview); }
public void Insert(PaymentOverview overview) { _data.Add(overview); }
private double CalculateAPR(PaymentOverview overview) { //todo how to calculate APR? return(0); }