dos_compilers/Digital Research PLI-86 v1/LOAN1.PLI
2024-06-30 12:01:25 -07:00

42 lines
1.3 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/******************************************************/
/* This program produces a schedule of loan payments */
/* using the following algorithm: if P = loan payment,*/
/* i = interest, and PMT is the monthly payment then */
/* P = (P + (i*P) - PMT. */
/******************************************************/
loan1:
procedure options(main);
declare
m fixed binary,
y fixed binary,
P fixed decimal(11,2),
PMT fixed decimal(6,2),
i fixed decimal(4,2);
do while('1'b);
put skip list('Principal ');
get list(P);
put list('Interest ');
get list(i);
put list('Payment ');
get list(PMT);
m = 0;
y = 0;
do while (P > 0);
if mod(m,12) = 0 then
do;
y = y + 1;
put skip list('Year',y);
end;
m = m + 1;
put skip list(m,P);
P = P + round( i * P / 1200, 2);
if P < PMT
then PMT = P;
put list(PMT);
P = P - PMT;
end;
end;
end loan1;