100 rem ******************************** 110 rem * * 120 rem * finance calculator * 130 rem * * 140 rem * re-written from original pet * 150 rem * program that appeared in * 160 rem * kilobaud (august 1978) * 170 rem * * 180 rem * adapted by robert w. baker * 190 rem *15 windsor dr, atco, nj 08004 * 200 rem * * 210 rem ******************************** 220 : 230 l1$=chr$(17)+"----------------------------------------" 240 printchr$(147):print:print" f i n a n c e c a l c u l a t o r":printl1$ 250 print" investment calculations":print 260 print"1 - future value of one-time investment" 270 print"2 - future value of regular deposits" 280 print"3 - regular deposits required" 290 print" to create a desired total value" 300 print" loan calculations" 310 print"4 - regular payment on a loan" 320 print"5 - last payment on a loan" 330 print"6 - term of a loan" 340 print"7 - remaining balance on a loan" 350 print"8 - cost of borrowing":print 360 print"9 - end of program" 370 print l1$:print" desired function (1-9):"; 380 get c$: if c$="" then 380 390 v=val(c$):if v=9 then print"":end 400 on v gosub 420,520,630,740,850,970,1080,1200 410 run 420 printchr$(147):print:print"future value of one-time investment":print l1$ 430 print"enter initial investment:":input i1 440 print"enter nominal interest rate:":input r 450 print"term of investment (years,months):":input y,m 460 print"number of compounding periods / year:":input n 470 r=r/n/100:y=(12*y+m)/12 480 t2=i1*(1+r)(n*y):t2=int(t2*100+0.5)/100 490 i2=t2-i1:gosub1380 500 gosub 1350:if a$="y" then 420 510 return 520 printchr$(147):print:print"future value of regular deposits":print l1$ 530 print"enter amount of each deposit:":input d 540 print"enter interest rate:":input r 550 print"term of investment (years,months):":input y,m 560 print"number of deposits per year:":input n 570 r=r/n/100:y=(12*y+m)/12 580 t2=d*((1+r)(n*y)-1)/r 590 t2=int(t2*100+.5)/100 600 i1=d*y*n:i2=t2-i1:gosub 1380 610 gosub 1350:if a$="y" then 520 620 return 630 printchr$(147):print:print"required regular deposits":print l1$ 640 print"enter the desired total value:":input t2 650 print"enter nominal interest rate:":input r 660 print"term of investment (years,months):":input y,m 670 print"number of deposits per year:": input n 680 r=r/n/100:y=(12*y+m)/12 690 d=t2*r/((1+r)(n*y)-1):d=int(d*100+0.5)/100 700 x1=d:gosub 1430:i1=d*y*n:i2=t2-i1 710 print:print"regular deposits: ";x$:gosub1380 720 gosub1350:ifa$="y" then 630 730 return 740 printchr$(147):print:print"regular payment on a loan":print l1$ 750 print"enter the principal amount:":input p1 760 print"enter the term of loan (years,months):":input y,m 770 print"enter the annual interest rate:":input r 780 print"number of payments per year:":input n 790 r=r/n/100:y=(y*12+m)/12 800 p3=1/(1+r)(n*y):p2=p1*r/(1-p3) 810 x1=p2:gosub 1430:print l1$ 820 print"regular payment: ";x$:print l1$ 830 gosub 1350:if a$="y" then 740 840 return 850 printchr$(147):print:print:print"last payment on a loan 860 print"enter the principle amount:":input p1 870 print"enter term of loan (years,months):":input y,m 880 print"enter the annual interest rate:":input r 890 print"number of payments per year:":input n 900 print"enter amount of regular payment:":input p4 910 r=r/n/100:y=(y*12+m)/12:i1=n*y 920 for i=1 to i1:r1=int(p1*r*100+0.5)/100:r2=p4-r1:p1=p1-r2:nexti 930 p2=p4+p1:x1=p2:gosub1430:print l1$ 940 print"last payment: ";x$:print l1$ 950 gosub 1350:if a$="y" then 850 960 return 970 printchr$(147):print:print:print"term of a loan":print l1$ 980 print"enter the principal amount:":input p1 990 print"enter amount of regular payment:":input p4 1000 print"enter the annual interest rate:":input r 1010 print"number of payments per year:":input n 1020 r=r/n/100:t1=1-(p1*r/p4):t2=1+r 1030 t=-(log(t1)/log(t2))/n 1040 m=int(t*12):y=int(m/12):m=m-y*12:print l1$ 1050 print"term of loan: ";y;"years,";m;"months":print l1$ 1060 gosub 1350:if a$="y" then 970 1070 return 1080 printchr$(147):print:print:print"remaining balance on a loan":print l1$ 1090 print"enter the principal amount:":input p1 1100 print"enter amount of regular payment:":input p4 1110 print"enter the annual interest rate:":input r 1120 print"number of payments per year:":input n 1130 print"number of payments made:":input i1 1140 r=r/n/100 1150 for i=1 to i1:r1=int(p1*r*100+0.5)/100:r2=p4-r1:p1=p1-r2:nexti 1160 x1=p1:gosub 1430:print l1$ 1170 print"remaining balance: ";x$:print l1$ 1180 gosub 1350:if a$="y" then 1080 1190 return 1200 printchr$(147):print:print:print"cost of borrowing":print l1$ 1210 print"enter principal amount:":input p1 1220 print"enter term of loan (years, months):":input y,m 1230 print"enter the annual interest rate:":input r 1240 print"number of payments each year:":input n 1250 r=r/n/100:y=(y*12+m)/12:p3=1/(1+r)(n*y) 1260 p4=p1*r/(1-p3):p4=int(p4*100+0.5)/100:p5=p1:c=0:i1=n*y 1270 for i=1 to i1:r1=int(p5*r*100+0.5)/100 1280 r2=p4-r1:p5=p5-r2:c=c+p4:next i 1290 c=c+p5:c1=c-p1:print l1$ 1300 x1=p4:gosub 1430:print" regular payment: ";x$ 1310 x1=c:gosub 1430:print"total payments: ";x$ 1320 x1=c1:gosub 1430:print" cost of borrowing: ";x$ 1330 print l1$:gosub 1350:if a$="y" then 1200 1340 return 1350 print "another calculation (y/n):" 1360 get a$:if a$<>"y" and a$<>"n" then 1360 1370 return 1380 print l1$ 1390 x1=i1:gosub 1430:print"value of your investment: ";x$ 1400 x1=i2:gosub 1430:print"value of accum. interest: ";x$ 1410 x1=t2:gosub 1430:print" total value: ";x$ 1420 print l1$:return 1430 x1=int(x1*100+0.5)/100 1440 x2=int(x1):x3=(x1-x2)*100+1000 1450 x$="$"+str$(x2)+"."+right$(str$(x3),2):return ready.