+One application of functions is to perform vairous complicated (tedious) tasks for us.

+For example a mortgage calculation is a complicated to do by hand,

+but we can make the computer do the calculation for us using `JavaScript`.

+Consider a mortgage payment calculation.

+ / // n = number of years # not used

+ / // k = number of months

+ / // S = initial sum borrowed

+ / // P = monthrly payment amount

+ / // I = monthly interest rate (= 1/12-th of the nominal annual percentage rate (I=0.05 for nAPR of 6%)

+ / // Zr(k,S,I,P) = amount owed after k-th payment P on a monthly loan of initial amount S at interest rate I

+ Zr = function (k, S, I, P) {

+ if (k == 0) { return S };

+ return Zr(k-1,S,I,P)*(1+I)-P;

+For a loan of 1000 the money owed after zero monthsis:

+ Zr(0,1000,0.005,100) // 6% nAPR = 0.005% monthly

+After one months has passed, and a payment of 100 has been made:

+ Zr(1,1000,0.005,100) // 6% nAPR = 0.005% monthly

+ / // the interest for one month was $5 but a payment of $100 cut the sum down a bit

+After two months, you owe:

+Monthly payment calculation

+---------------------------

+Assuming a 25 year mortgage of $315000, we can manually plug different values of

+the payment until we find the payment amount P which reduces the amount owed to zero

+The monthly payment for a 3% nomian annual percentage rate is $1497.77

+ Zr(25*12,315000,0.0025,1493.76) // 3% nAPR = 0.0025% monthly

+The monthly payment for a 4% nomian annual percentage rate is $1662.69

+ Zr(25*12,315000, I,1662.69)

+The monthly payment for a 5% nomian annual percentage rate is $1841.54

+ I = 0.05/12 // = 0.004166666666666667

+ Zr(25*12, 315000, I, 1841.54)

+The monthly payment for a 6% nomian annual percentage rate is $2029.55

+ Zr(25*12,315000, I,2029.55)

+Ajouter condo fees ?? et taxes ville de montreal + taxes scolaires.

+Third-of-a-million dollar quesion

+---------------------------------

+Assuming interest rate goes up to 5%, condo fees + taxes of 300,

+can your rent that condo for 2141.54 par mois pour couvrir les fais.