Payment.bas


Title: payment
Description: List an Amortizations table of loan with monthly payments
rem Example:
rem input:
rem Loan : 100000
rem Nro payments: 36
rem Annual Interes Rate: 12
rem Output:
rem Amortization Table in Palm Memo Pad:
rem
rem Amortization of loan with monthly payments
rem Mount of loan: $6000
rem Nro of payments: 36
rem Month Interes 0.83
rem Num of Month
rem Payment Principal Int Payment Balance
rem 0 0.00 0.00 193.60 6,000.00
rem 1 143.60 50.00 193.60 5,856.40
rem 2 144.80 48.80 193.60 5,711.60
rem 3 146.01 47.60 193.60 5,565.59
rem 4 147.22 46.38 193.60 5,418.37
rem 5 148.45 45.15 193.60 5,269.92
rem 6 149.69 43.92 193.60 5,120.23
rem 7 150.93 42.67 193.60 4,969.30
rem 8 152.19 41.41 193.60 4,817.10
rem 9 153.46 40.14 193.60 4,663.64
rem 10 154.74 38.86 193.60 4,508.90
rem 11 156.03 37.57 193.60 4,352.87
rem 12 157.33 36.27 193.60 4,195.55
rem 13 158.64 34.96 193.60 4,036.90
rem 14 159.96 33.64 193.60 3,876.94
rem 15 161.30 32.31 193.60 3,715.65
rem 16 162.64 30.96 193.60 3,553.01
rem 17 163.99 29.61 193.60 3,389.01
rem 18 165.36 28.24 193.60 3,223.65
rem 19 166.74 26.86 193.60 3,056.91
rem 20 168.13 25.47 193.60 2,888.78
rem 21 169.53 24.07 193.60 2,719.25
rem 22 170.94 22.66 193.60 2,548.31
rem 23 172.37 21.24 193.60 2,375.94
rem 24 173.80 19.80 193.60 2,202.14
rem 25 175.25 18.35 193.60 2,026.89
rem 26 176.71 16.89 193.60 1,850.18
rem 27 178.18 15.42 193.60 1,671.99
rem 28 179.67 13.93 193.60 1,492.32
rem 29 181.17 12.44 193.60 1,311.15
rem 30 182.68 10.93 193.60 1,128.48
rem 31 184.20 9.40 193.60 944.28
rem 32 185.73 7.87 193.60 758.54
rem 33 187.28 6.32 193.60 571.26
rem 34 188.84 4.76 193.60 382.42
rem 35 190.42 3.19 193.60 192.00
rem 36 192.00 1.60 193.60 0.00
rem ========= ======= ========
rem 6,000.00 969.71 6,969.71
rem


Category: Business
Copyright: Adolfo Leon Sepulveda
Email: adoleon2000@yahoo.com.mx
Created: Sep/06/2004
Version: 1.0
Sbver:


'#sec:Main
''Payment.bas
'' 09/06/2004
''version 1.0
''By Adolfo Leon Sepulveda
''Amortization''s table of loan with monthly payments
''Example:
'' input:
'' Loan : 100000
'' Nro payments: 36
'' Annual Interes Rate: 12
''Output:
'' Amortization Table in Palm Memo Pad"
declare func payment(loan,MonthInteresRate,NroPayments)
local pago, capi, Tinte, Tbal, Total
local loan, NroPayments, AnnualInteresRate
local MonthInteresRate, bal, pmt
local k;

OPEN "memo:Amortization" FOR OUTPUT AS #1

pago = 0
capi = 0
Tinte = 0.0
Tbal =0.0
total = 0.0
Print "Amortization of loan with monthly payments"
input "Loan: "; loan
Input "Nro Payments: ";NroPayments
input "Annual Interes Rate: "; AnnualInteresRate
AnnualInteresRate = AnnualInteresRate/100
MonthInteresRate = AnnualInteresRate/12
print "Processing.."
pmt = payment(loan,MonthInteresRate,NroPayments)
bal = loan
print #1,"Amortization of loan with monthly payments"
print #1, "Mount of loan: $";
print #1, using "###,###.#";loan
print #1,"Nro of payments:";
print #1, using "###"; NroPayments
print #1,"Month Interes";
print #1, using "###0.00%"; MonthInteresRate*100

print #1, "Nro Month "
print #1, "Pmt Princ Int Pmt Bal"
print #1, using "## "; k;

print #1,spc(48);
print #1, using "###,###";bal

for k =1 to NroPayments
Inte = MonthInteresRate * bal
capi = (pmt-inte)
bal = bal - capi
Tinteres = Tinteres + inte
Tbal = Tbal + capi
total = total + pmt
print #1, using "### "; k;
print #1, using " ###,###"; capi, inte, pmt;
print #1, using " ###,###";bal
next k
print #1," ==== ==== ===="
print #1, using " ###,###";tbal;
print #1, using "###,###";tinteres;
print #1, using "###,###"; total
print "See results in Amortization of Memo Pad"
close #1
end

func
payment(loan,MonthInteresRate,NroPayments)
local tmp
tmp = (1 + MonthInteresRate)^NroPayments
payment = MonthInteresRate * loan * tmp / (tmp - 1)
end
'