|
- 10 L1=9
- 20 DEF FNR(X)=INT(X*100+.5)/100
- 30 CL$=CHR$(26):REM SCREEN CLEAR CHAR.
- 40 REM ********************************************************
- 50 REM
- 60 PRINT CL$;"THIS PROGRAM IS A COLLECTION OF BUSINESS"
- 70 PRINT "APPLICATIONS. HERE IS A LIST OF THE VALUES THAT"
- 80 PRINT "CAN BE COMPUTED GIVEN SUPPORTING DATA:"
- 90 PRINT
- 100 PRINT "1) FUTURE VALUE OF AN INVESTMENT"
- 110 PRINT "2) FUTURE VALUE OF REGULAR DEPOSITS (ANNUITY)"
- 120 PRINT "3) REGULAR DEPOSITS"
- 130 PRINT "4) REGULAR DEPOSITS FROM AN INVESTMENT"
- 140 PRINT "5) INITIAL INVESTMENT"
- 150 PRINT "6) MINIMUM INVESTMENT FOR WITHDRAWALS"
- 160 PRINT "7) NOMINAL INTEREST RATE ON INVESTMENTS"
- 170 PRINT "8) EFFECTIVE INTEREST RATE ON INVESTMENTS"
- 180 PRINT "9) EARNED INTEREST TABLE"
- 190 PRINT
- 200 PRINT "WHICH OF THE ABOVE VALUES WOULD YOU LIKE"
- 210 PRINT "TO COMPUTE ( 1 TO";L1;", OR 0 TO END RUN )";
- 220 INPUT X
- 230 PRINT CL$
- 240 IF X=0 THEN 1860
- 250 ON X GOSUB 270,360,470,590,690,800,910,1010,1150
- 260 GOTO 90
- 270 PRINT "FUTURE VALUE OF AN INVESTMENT"
- 280 PRINT:INPUT "INITIAL INVESTMENT (0 TO STOP) ";P:IF P=0 THEN RETURN
- 290 GOSUB 1130
- 300 GOSUB 1140
- 310 GOSUB 1110
- 320 I=I/N/100
- 330 T=P*(I+1)^(N*Y)
- 340 GOSUB 1100
- 350 GOTO 280
- 360 PRINT "FUTURE VALUE OF REGULAR DEPOSITS (ANNUITY)"
- 370 PRINT
- 380 INPUT "AMOUNT OF REGULAR DEPOSITS (0 TO STOP)";R
- 390 IF R=0 THEN RETURN
- 400 GOSUB 1130
- 410 INPUT "NUMBER OF DEPOSITS PER YEAR";N
- 420 GOSUB 1110
- 430 I=I/N/100
- 440 T=R*((I+1)^(N*Y)-1)/I
- 450 GOSUB 1100
- 460 GOTO 370
- 470 PRINT "REGULAR DEPOSITS"
- 480 PRINT
- 490 INPUT "TOTAL VALUE AFTER Y YEARS (0 TO STOP) ";T
- 500 IF T=0 THEN RETURN
- 510 GOSUB 1130
- 520 DEF FNR(X)=INT(X*100+.5)/100
- 530 INPUT "NUMBER OF DEPOSITS PER YEAR";N
- 540 GOSUB 1110
- 550 I=I/N/100
- 560 R=T*I/((I+1)^(N+Y)-1)
- 570 PRINT "REGULAR DEPOSITS: $";INT(R*100+.5)/100
- 580 GOTO 480
- 590 PRINT "REGULAR WITHDRAWALS FROM AN INVESTMENT"
- 600 PRINT:INPUT"INITIAL INVESTMENT (0 TO STOP) ";P
- 610 IF P=0 THEN RETURN
- 620 GOSUB 1130
- 630 INPUT "NUMBER OF WITHDRAWALS PER YEAR";N
- 640 GOSUB 1110
- 650 I=I/N/100
- 660 R=P*(I/((I+1)^(N*Y)-1)+I)
- 670 PRINT "AMOUNT OF EACH WITHDRAWAL = $";INT(R*100+.5)/100
- 680 GOTO 600
- 690 PRINT "INITIAL INVESTMENT"
- 700 PRINT
- 710 INPUT "TOTAL VALUE AFTER Y YEARS (0 TO STOP) ";T
- 720 IF T=0 THEN RETURN
- 730 GOSUB 1140
- 740 GOSUB 1110
- 750 GOSUB 1130
- 760 I=I/N/100
- 770 P=T/(I+1)^(N*Y)
- 780 PRINT "INITIAL INVESTMENT = $";INT(P*100+.5)/100
- 790 GOTO 700
- 800 PRINT "MINIMUM INVESTMENT FOR WITHDRAWALS"
- 810 PRINT
- 820 INPUT "AMOUNT OF WITHDRAWALS (0 TO STOP) ";R
- 830 IF R=0 THEN RETURN
- 840 GOSUB 1130
- 850 INPUT "NUMBER OF WITHDRAWALS PER YEAR";N
- 860 GOSUB 1110
- 870 I=I/100
- 880 P=R*N/I*(1-1/((1+I/N)^(N*Y)))
- 890 PRINT "MINIMUM INVESTMENT = $";INT(100*P+.5)/100
- 900 GOTO 810
- 910 PRINT "NOMINAL INTEREST RATE ON INVESTMENTS"
- 920 PRINT
- 930 INPUT "PRINCIPAL (0 TO STOP)";P
- 940 IF P=0 THEN RETURN
- 950 INPUT "TOTAL VALUE";T
- 960 GOSUB 1110
- 970 GOSUB 1140
- 980 I2=N*((T/P)^(1/(N*Y))-1)*100
- 990 PRINT "NOMINAL INTEREST RATE = ";I2;"%"
- 1000 GOTO 920
- 1010 PRINT "EFFECTIVE INTEREST RATE ON INVESTMENTS"
- 1020 PRINT
- 1030 INPUT "INITIAL INVESTMENT (0 TO STOP) ";P
- 1040 IF P=0 THEN RETURN
- 1050 INPUT "TOTAL VALUE AFTER Y YEARS";T
- 1060 GOSUB 1110
- 1070 PRINT "ANNUAL INTEREST RATE = ";((T/P)^(1/Y)-1)*100;"%"
- 1080 GOTO 1020
- 1090 REM *******
- 1100 PRINT "FUTURE VALUE = $"; INT(T*100+.5)/100:RETURN
- 1110 INPUT "NUMBER OF YEARS AND MONTHS (2 NUMBERS WITH A COMMA BETWEEN THEM)";Y0,M
- 1120 Y=(12*Y0+M)/12:RETURN
- 1130 INPUT "NOMINAL INTEREST RATE (0 TO 100) ";I:RETURN
- 1140 INPUT "NUMBER OF COMPOUNDING PERIODS PER YEAR";N:RETURN
- 1150 PRINT "**** EARNED INTEREST TABLE GENERATOR ***"
- 1160 PRINT
- 1170 INPUT "PRINCIPAL";P
- 1180 GOSUB 1130
- 1190 I=I/100
- 1200 INPUT "NUMBER OF DEPOSITS/WITHDRAWALS PER YEAR";N1
- 1210 IF N1=0 THEN 1260
- 1220 INPUT "AMOUNT OF DEPOSIT/WITHDRAWAL";R
- 1230 N=360
- 1240 L2=N1
- 1250 GOTO 1290
- 1260 GOSUB 1140
- 1270 N1=0
- 1280 L2=4
- 1290 INPUT "START WITH WHAT YEAR (WHERE 1 MEANS THE FIRST, 2 THE SECOND, ETC.) ";X
- 1300 INPUT "END WITH WHAT YEAR";Y
- 1310 X=INT(X)
- 1320 B0=P:I1=0:I2=0:I3=0:K=66:P1=4
- 1330 FOR J0=1 TO INT(Y)+1
- 1340 IF J0<X THEN 1510
- 1350 IF K<55 THEN 1500
- 1360 REM SPACE TO NEXT PAGE, PRINT HEADINGS (ASSUMING 66 LINES/PAGE)
- 1370 FOR K1=K TO 66
- 1380 PRINT
- 1390 NEXT K1
- 1400 K=6
- 1410 PRINT " EARNED INTEREST TABLE"
- 1420 PRINT " PRINCIPAL= $";P;" AT ";I*100;"% NOMINAL FOR ";Y;"YEARS"
- 1430 IF N1=0 THEN 1460
- 1440 PRINT "REGULAR DEPOSIT/WITHDRAWAL $";R;". ";N1;" TIMES PER YEAR"
- 1450 K=K+1
- 1460 PRINT " EFFECTIVE INTEREST RATE";FNR(100*((1+I/N)^N-1));"% PER YEAR"
- 1470 PRINT
- 1480 PRINT "YEAR","BALANCE","INTEREST","ACCUM. INTEREST"
- 1490 PRINT
- 1500 PRINT J0,
- 1510 L1=1
- 1520 N2=1
- 1530 P2=1
- 1540 FOR J1=1 TO N
- 1550 IF N2>N1 THEN 1590
- 1560 IF N2/N1>J1/N THEN 1590
- 1570 B0=B0+R
- 1580 N2=N2+1
- 1590 B2=B0*(1+I/N)
- 1600 I1=B2-B0
- 1610 I3=I3+I1
- 1620 I2=I2+I1
- 1630 IF P2/P1>J1/N THEN 1670
- 1640 I2=FNR(I2)
- 1650 B2=FNR(B2)
- 1660 P2=P2+1
- 1670 IF J0<X THEN 1750
- 1680 IF J1/N<L1/L2 THEN 1750
- 1690 L1=L1+1
- 1700 PRINT TAB(17);
- 1710 PRINT FNR(B2),FNR(I3),FNR(I2)
- 1720 I3=0
- 1730 K=K+1
- 1740 REM
- 1750 B0=B2
- 1760 IF J0+J1/N-1>=Y THEN 1820
- 1770 NEXT J1
- 1780 IF J0<X THEN 1810
- 1790 PRINT
- 1800 K=K+1
- 1810 NEXT J0
- 1820 PRINT
- 1830 PRINT "CHANGE DATA AND RECOMPUTE ";
- 1840 INPUT A$:IF LEFT$(A$,1)="Y" THEN 1160
- 1850 RETURN
- 1860 REM RUN "DIR"
- 1870 END
- 2000 REM -------------------------------
- 2010 REM commented out line 1860
- 2020 REM added space after IF stmts
- 2999 END
|