def get_total_cost(loan_terms): rate = loan_terms['apr'] years = loan_terms['years'] amount = loan_terms['amount'] return LoanView.display_basic( 'Total Cost', Loan.calc_total_cost(rate, years, amount))
def get_monthly_payment(loan_terms): rate = loan_terms['apr'] years = loan_terms['years'] amount = loan_terms['amount'] return LoanView.display_basic( 'Monthly Payment', Loan.calc_monthly_payment(rate, years, amount))
def get_total_remaining(loan_terms): rate = loan_terms['apr'] years = loan_terms['years'] amount = loan_terms['amount'] current_period = loan_terms['current_period'] return LoanView.display_basic( 'Total Remaining', Loan.calc_total_remaining(rate, years, amount, current_period))
def test_calc_monthly_payment(self): result = Loan.calc_monthly_payment(0.04, 5, 10000) self.assertEqual(result, 184.17)
def test_calc_total_remaining(self): result = Loan.calc_total_remaining(0.04, 5, 10000, 59) self.assertEqual(result, 184.16)
def test_calc_total_cost(self): result = Loan.calc_total_cost(0.04, 5, 10000) self.assertEqual(result, 11049.91)
def get_amortization_schedule(): return LoanView.display_amortization_schedule( Loan.calc_amortization_schedule())
def get_interest_remaining(): return LoanView.display_basic('Interest Remaining', Loan.calc_interest_remaining())
def get_interest_paid(): return LoanView.display_basic('Interest Paid', Loan.calc_interest_paid())
def get_principle_remaining(): return LoanView.display_basic('Principle Remaining', Loan.calc_principle_remaining())
def get_principle_paid(): return LoanView.display_basic('Principle Paid', Loan.calc_principle_paid())
def get_payment_ipart(): return LoanView.display_basic('Interest Part', Loan.calc_payment_ipart())
def get_payment_ppart(): return LoanView.display_basic('Principle Part', Loan.calc_payment_ppart())