-
Notifications
You must be signed in to change notification settings - Fork 0
/
money.ndf
43 lines (28 loc) · 1.12 KB
/
money.ndf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
% Money ;
% ---------------------------------------------------------------------------------- ;
% Debt ;
Initial_amount := 100000 ;
% Time period (10 years) ;
Months := 10 * 12 ;
% Monthly debt growth (1.00417) ;
I := 5 / 100 / 12 + 1 ;
% Monthly payments ;
Mn1 := 1060.66 ; Mn2 := 1000 ;
% ---------------------------------------------------------------------------------- ;
% Debt after 'Months' months ;
Ipm := I power Months ;
Rt := Ipm - 1 / (I - 1) ;
D1 := Ipm * Initial_amount - (Mn1 * Rt) ;
D2 := Ipm * Initial_amount - (Mn2 * Rt) ;
% String constant ;
Mps := 'Monthly payment ' ;
% Display results ;
write (link 'Debt after ' (string Months) ' months:') ;
write (link Mps (string Mn1) ': ' (string D1)) ;
write (link Mps (string Mn2) ': ' (string D2)) ;
% ---------------------------------------------------------------------------------- ;
% Calculate monthly debt payment ;
Mp := Initial_amount * Ipm * (I - 1) / (Ipm - 1) ;
% Show monthly payment ;
write (link 'Monthly debt payment for ' (string Months) ' months: ' (string Mp)) ;
% ---------------------------------------------------------------------------------- ;