home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1985 November / Ahoy_Magazine_85-11_1985_Double_L.d64 / compuloan (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  2KB  |  86 lines

  1. 5 print"[147]":poke53280,0:poke53281,6:poke646,1
  2. 10 print "copyright 1985 cheryl peterson"
  3. 15 print"loan payment calculator"
  4. 20 print"s[146]creen display or p[146]rintout?"
  5. 30 get s$:if s$=""goto30
  6. 35 if s$="s" or s$="p" then 40
  7. 36 print"was that an s[146] or a p[146]?":goto20
  8. 40 print"view/print payback schedule (y[146] or n[146])?"
  9. 50 get v$:if v$=""then50
  10. 55 if v$="y" or v$="n" then 210
  11. 60 print"was that a y[146] or an n[146]?":goto50
  12. 210 input"enter cash value being financed";a
  13. 215 k=a:gosub 1000
  14. 216 a=k
  15. 220 input"enter number of payments per year";n
  16. 225 k=n:gosub 1000
  17. 226 n=k
  18. 230 input"enter total number of payments to make";t
  19. 235 k=t:gosub 1000
  20. 236 t=k
  21. 240 input"enter yearly interest rate";i
  22. 241 k=i:gosub 1000
  23. 242 i=k
  24. 243 ii=i:i=i/100
  25. 250 if s$="s"then 260
  26. 251 open1,4,7:cmd1
  27. 260 print chr$(147)
  28. 270 print"loan payment calculator"
  29. 275 gosub 4030
  30. 280 print"amount financed $";a$
  31. 285 print"interest rate";ii;"%."
  32. 290 print"# of payments per year: ";n
  33. 300 print"total number of payments is ";t
  34. 400 p=a*(i/n)/(1-(1/(1+(i/n))^(t)))
  35. 410 z=p*t:c=z-a
  36. 600 gosub 3000
  37. 610 print"each payment is";p$
  38. 620 print"total interest paid is $";c$
  39. 630 print"total amount paid is $";z$
  40. 640 print
  41. 690 ifv$<>"y"then845
  42. 691 c=a*i/n
  43. 695 j=p-c
  44. 697 a=a+c
  45. 700 if s$="s" then 705
  46. 701 print spc(7);"balance";spc(9);"payment";spc(8);
  47. 702 print"interest";spc(7);"principle":goto 710
  48. 705 print" balance";spc(3);"payment";spc(2);"interest";spc(1);"principle"
  49. 710 x=1
  50. 720 gosub 3000
  51. 725 gosub 4000
  52. 730 if x=50 and x2<1then print chr$(12):x=1:x2=x2+1:goto 700
  53. 740 if x2>0 and x=60 then print chr$(12):x=1:goto 700
  54. 750 if len(a$)<=8 then a1=9-len(a$)
  55. 751 if len(p$)<=8 then p1=9-len(p$)
  56. 752 if len(c$)<=8 then c1=9-len(c$)
  57. 753 if len(j$)<=8 then j1=9-len(j$)
  58. 760 if s$="s" then 765
  59. 761 print spc(a1+6);a$;spc(p1+6);p$;spc(c1+6);c$;spc(j1+6);j$:goto 770
  60. 765 print spc(a1);a$;spc(p1);p$;spc(c1);c$;spc(j1);j$
  61. 770 a=a+c-p:c=a*i/n:j=p-c
  62. 820 if a+c<=p then p=a+c:j=a
  63. 825 if a<=.01 then 845
  64. 830 x=x+1
  65. 840 goto 720
  66. 845 if s$="s"thenend
  67. 850 print#1:close 1:end
  68. 999 end
  69. 1000 k=abs(k):return
  70. 2000 b=int(b*100+.001):b$=str$(b):b$=left$(b$,len(b$)-2)+"."+right$(b$,2)
  71. 2090 return
  72. 3000 rem truncate p,c and z
  73. 3010 b=p:gosub 2000
  74. 3020 p$=b$
  75. 3030 b=c:gosub 2000
  76. 3040 c$=b$
  77. 3050 b=z:gosub 2000
  78. 3060 z$=b$
  79. 3090 return
  80. 4000 rem truncate a and j
  81. 4010 b=j:gosub 2000
  82. 4020 j$=b$
  83. 4030 b=a:gosub 2000
  84. 4040 a$=b$
  85. 4090 return
  86.