You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# [Financing a purchase](https://www.codewars.com/kata/financing-a-purchase"https://www.codewars.com/kata/59c68ea2aeb2843e18000109")
2
2
3
-
The description is rather long but it tries to explain what a financing plan is.
3
+
The description is rather long, but it tries to explain what a financing plan is.
4
4
5
-
The fixed monthly payment for a fixed rate mortgage is the amount paid by the borrower every month that ensures
6
-
that the loan is paid off in full with interest at the end of its term.
5
+
The fixed monthly payment for a fixed rate mortgage is the amount paid by the borrower every month that ensures
6
+
that the loan is paid off in full, with interest at the end of its term.
7
7
8
-
The monthly payment formula is based on the annuity formula.
8
+
The monthly payment formula is based on the annuity formula.
9
9
The monthly payment `c` depends upon:
10
10
11
-
-`rate` - the monthly interest rate is expressed as a decimal, not a percentage.
12
-
The monthly rate is simply the **given** yearly percentage rate divided by 100 and then by 12.
11
+
-`rate` - the monthly interest rate is expressed as a decimal, not a percentage.
12
+
The monthly rate is simply the **given** yearly percentage rate divided by 100 and then by 12.
13
13
14
14
-`term` - the number of monthly payments, called the loan's `term`.
15
15
-`principal` - the amount borrowed, known as the loan's principal (or `balance`).
16
16
17
17
First we have to determine `c`.
18
18
19
-
We have: `c = n /d` with `n = r LICENSE build.gradle.kts docs gradle gradle.properties gradlew gradlew.bat kata settings.gradle.kts balance` and `d = 1 - (1 + r)**(-term)` where `**` is the `power` function (you can look at the reference below).
19
+
We have: `c = n /d` with `n = r LICENSE build.gradle.kts docs gradle gradle.properties gradlew gradlew.bat kata settings.gradle.kts balance`
20
+
and `d = 1 - (1 + r)**(-term)` where `**` is the `power` function (you can look at the reference below).
20
21
21
22
The payment `c` is composed of two parts. The first part pays the interest (let us call it `int`)
22
-
due for the balance of the given month, the second part repays the balance (let us call this part `princ`) hence for the following month we get a `new balance = old balance - princ` with `c = int + princ`.
23
+
due for the balance of the given month, the second part repays the balance (let us call this part `princ`) hence for the following month we
24
+
get a `new balance = old balance - princ` with `c = int + princ`.
23
25
24
-
Loans are structured so that the amount of principal returned to the borrower starts out small and increases with each mortgage payment.
25
-
While the mortgage payments in the first years consist primarily of interest payments, the payments in the final years consist primarily of principal repayment.
26
+
Loans are structured so that the amount of principal returned to the borrower starts out small and increases with each mortgage payment.
27
+
While the mortgage payments in the first years consist primarily of interest payments, the payments in the final years consist primarily of
28
+
principal repayment.
26
29
27
-
A mortgage's amortization schedule provides a detailed look at precisely what portion of each mortgage payment is dedicated to each component.
30
+
A mortgage's amortization schedule provides a detailed look at precisely what portion of each mortgage payment is dedicated to each
31
+
component.
28
32
29
33
In an example of a $100,000, 30-year mortgage with a rate of 6 percents the amortization schedule consists of 360 monthly payments.
30
34
The partial amortization schedule below shows with 2 decimal floats
31
35
the balance between principal and interest payments.
0 commit comments