Roy Sheppard Mark
Roy Sheppard Logo

Loan Calculator

Overview

Challenge

Write a mortgage loan calculator application that takes in three parameters:

  1. The amount of money loaned in pounds (balance)
  2. The time over which the loan will be repaid, in months (term)
  3. The percentage rate at which interest will accrue on the loan (rate)

The output should include the following:

  1. The month (1 corresponding to the 1st month of payment, through the total number of months)
  2. The payment amount
  3. The principal paid this month
  4. The interest paid this month
  5. The total interest paid to date
  6. The remaining loan balance at the end of the month

Formulas Used

Total Monthly Payment = (amount loaned) * (rate/1200) / (1 – (1 + rate/1200)(-Number of Months) )

The Remaining Balance before the very first month equals the amount of the loan.

Interest Payment = Previous Remaining Balance * rate/1200

Principal Payment = Total Monthly Payment - Interest Payment

At the end of each month, Remaining Balance = Previous Remaining Balance - principal payments

Features

  • CSS and BootStrap Layout
  • DOM Manipulation
  • Event Listeners
  • For Loops
  • Functions
  • HTML Templating
  • If Statements
  • String Methods
  • Type Casting

Tech Stack

  • HTML5HTML5
  • CSS3CSS3
  • BootstrapBootstrap
  • TypeScriptTypeScript