home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1985 November
/
Ahoy_Magazine_85-11_1985_Double_L.d64
/
compuloan
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
2KB
|
86 lines
5 print"[147]":poke53280,0:poke53281,6:poke646,1
10 print "copyright 1985 cheryl peterson"
15 print"loan payment calculator"
20 print"s[146]creen display or p[146]rintout?"
30 get s$:if s$=""goto30
35 if s$="s" or s$="p" then 40
36 print"was that an s[146] or a p[146]?":goto20
40 print"view/print payback schedule (y[146] or n[146])?"
50 get v$:if v$=""then50
55 if v$="y" or v$="n" then 210
60 print"was that a y[146] or an n[146]?":goto50
210 input"enter cash value being financed";a
215 k=a:gosub 1000
216 a=k
220 input"enter number of payments per year";n
225 k=n:gosub 1000
226 n=k
230 input"enter total number of payments to make";t
235 k=t:gosub 1000
236 t=k
240 input"enter yearly interest rate";i
241 k=i:gosub 1000
242 i=k
243 ii=i:i=i/100
250 if s$="s"then 260
251 open1,4,7:cmd1
260 print chr$(147)
270 print"loan payment calculator"
275 gosub 4030
280 print"amount financed $";a$
285 print"interest rate";ii;"%."
290 print"# of payments per year: ";n
300 print"total number of payments is ";t
400 p=a*(i/n)/(1-(1/(1+(i/n))^(t)))
410 z=p*t:c=z-a
600 gosub 3000
610 print"each payment is";p$
620 print"total interest paid is $";c$
630 print"total amount paid is $";z$
640 print
690 ifv$<>"y"then845
691 c=a*i/n
695 j=p-c
697 a=a+c
700 if s$="s" then 705
701 print spc(7);"balance";spc(9);"payment";spc(8);
702 print"interest";spc(7);"principle":goto 710
705 print" balance";spc(3);"payment";spc(2);"interest";spc(1);"principle"
710 x=1
720 gosub 3000
725 gosub 4000
730 if x=50 and x2<1then print chr$(12):x=1:x2=x2+1:goto 700
740 if x2>0 and x=60 then print chr$(12):x=1:goto 700
750 if len(a$)<=8 then a1=9-len(a$)
751 if len(p$)<=8 then p1=9-len(p$)
752 if len(c$)<=8 then c1=9-len(c$)
753 if len(j$)<=8 then j1=9-len(j$)
760 if s$="s" then 765
761 print spc(a1+6);a$;spc(p1+6);p$;spc(c1+6);c$;spc(j1+6);j$:goto 770
765 print spc(a1);a$;spc(p1);p$;spc(c1);c$;spc(j1);j$
770 a=a+c-p:c=a*i/n:j=p-c
820 if a+c<=p then p=a+c:j=a
825 if a<=.01 then 845
830 x=x+1
840 goto 720
845 if s$="s"thenend
850 print#1:close 1:end
999 end
1000 k=abs(k):return
2000 b=int(b*100+.001):b$=str$(b):b$=left$(b$,len(b$)-2)+"."+right$(b$,2)
2090 return
3000 rem truncate p,c and z
3010 b=p:gosub 2000
3020 p$=b$
3030 b=c:gosub 2000
3040 c$=b$
3050 b=z:gosub 2000
3060 z$=b$
3090 return
4000 rem truncate a and j
4010 b=j:gosub 2000
4020 j$=b$
4030 b=a:gosub 2000
4040 a$=b$
4090 return