5 REM FINANCE  VERSION 1.0  MARCH 4, 1982
10 COLOR 15:CLS:KEY OFF:SCREEN 0,0,0:WIDTH "SCRN:",80
20 ON ERROR GOTO 5950
25 PRINT "      * *  F I N A N C I A L   F U N C T I O N S  * *           (Version 1.0)": PRINT :PRINT
30 PRINT "SELECT ONE OF THE FOLLOWING FINANCIAL FUNCTIONS:"
40 PRINT
50 PRINT "     1 -- AMORTIZATION SCHEDULE"
60  PRINT "     2 -- DAYS BETWEEN DATES"
70 PRINT "     3 -- PRESENT VALUE OF A FUTURE SUM"
80 PRINT "     4 -- FUTURE VALUE OF A PRESENT SUM"
90 PRINT "     5 -- SIMPLE INTEREST FOR DAYS"
100 PRINT "     6 -- INTEREST RATE - COMPOUND INTEREST"
110 PRINT "     7 -- NOMINAL & EFFECTIVE INTEREST RATES
120 PRINT "     8 -- INTEREST RATE - INSTALLMENT LOAN"
130 PRINT "     9 -- PRESENT VALUE OF A SERIES OF PAYMENTS"
135 PRINT "    10 -- FUTURE VALUE OF REGULAR DEPOSITS
138 PRINT "    11 -- REGULAR DEPOSITS FOR FUTURE VALUE
140 PRINT "    12 -- INTERNAL RATE OF RETURN
146 PRINT "    13 -- BOND - PRESENT VALUE
147 PRINT "    14 -- BOND - YIELD TO MATURITY
149 PRINT "    15 -- EXIT FROM PROGRAM
151 PRINT:INPUT "          SELECT OPTION, THEN PRESS `ENTER' ==> ";FI
160 IF FI<1 OR FI > 15 THEN RUN
170 ON FI GOTO 720,1670,190,550,390,1030,4220,1310,2220,4630,4820,4380,5590,5750,180
180 END
181 STOP
189 REM -----------------------------------------------------------------
190 F=0:R=0:M=0:N=0
195 CLS: PRINT "      FUNCTION 3 -- PRESENT VALUE OF A FUTURE SUM ": PRINT: PRINT
200 PRINT:PRINT "This routine calculates the Present Value of a Future Sum, discounting"
210 PRINT "it for a given Interest Rate, compounded as instructed.":PRINT
230 INPUT "     FUTURE SUM  (IN DOLLARS)   ";F
240 INPUT "     ANNUAL INTEREST RATE  (%)  ";R
250 INPUT "     # OF PERIODS IN ONE YEAR   ";M
260 INPUT "     # PERIODS TO BE CALCULATED ";N
270 I=R/M:I=I/100
280 T=1+I:A=T
290 IF N=1 GOTO 310
300 FOR X=1 TO (N-1):S=A*T:A=S:NEXT X
310 P=F/A: PRINT: PRINT
320 PRINT " A Future Sum of $";F;" for ";N;" Periods, where there are "
330 PRINT M;"Periods per Year at";R;"% Annual Interest Rate, is worth "
350 PRINT:PRINT "     $";P;" in Today's Dollars"
353 PRINT: PRINT:
355 PRINT "WHAT DO YOU WANT TO DO: "
358 PRINT "     1 -- RETURN TO MAIN MENU"
360 PRINT "     2 -- RERUN CURRENT FUNCTION": PRINT
363 INPUT "          SELECT OPTION ==> ";IA
366 IF IA = 2 THEN GOTO 190
369 IF IA <>1 THEN GOTO 363
370 RUN
380 END
389 REM -----------------------------------------------------------------
390 P=0:D=0:R=0
395 CLS: PRINT "      FUNCTION 5 -- SIMPLE INTEREST FOR DAYS  ": PRINT: PRINT
400 PRINT "This routine calculates Simple Interest on dollars held in deposit"
420 PRINT "for a specified number of days, given a specific interest rate.":PRINT
430 INPUT "     AMOUNT OF DEPOSIT (IN DOLLARS) ";P
440 INPUT "     NUMBER OF DAYS ON DEPOSIT      ";D
450 INPUT "     INTEREST RATE (PERCENT)        ";R
460 PRINT:PRINT:PRINT "For a starting Principal of $";P;"at a ";
470 PRINT "Rate of";R;"% for ";D;"days"
480 PRINT:PRINT "     the Amount of Interest = $";
490 I=R/100/365*D*P
500 IF I>327.68 GOTO 520
510 I=INT(I*100+.5)/100
520 PRINT USING "###,###.##";I;:PRINT "   or   $";:PRINT USING "#,###.##";I/D;:PRINT" per day":PRINT:PRINT:PRINT
523 PRINT "WHAT DO YOU WANT TO DO: ": PRINT
525 PRINT "     1 -- RETURN TO MAIN MENU"
528 PRINT "     2 -- RERUN CURRENT FUNCTION": PRINT
530 INPUT "          SELECT OPTION ==> ";IA
533 IF IA = 2 THEN GOTO 390
536 IF IA <>1 THEN GOTO 530
539 RUN
540 END
549 REM -----------------------------------------------------------------
550 CLS:P=0:R=0:M=0:N=0
551 PRINT "     FUNCTION 4 -- FUTURE VALUE OF A PRESENT SUM ": PRINT: PRINT
552 PRINT"This function computes the Future Value of a Present Sum, given the"
553 PRINT "Annual Interest Rate, and the number of Periods to Maturity."
560 PRINT:INPUT "     PRESENT SUM (IN DOLLARS) ";P
570 INPUT "     ANNUAL INTEREST RATE (%) ";R
580 INPUT "     # OF PERIODS IN ONE YEAR ";M
590 INPUT "     # OF PERIODS TO MATURITY ";N
600 I=R/M:I=I/100:T=I+1:A=T
610 IF N=1 THEN GOTO 630
620 FOR K=1 TO (N-1):S=A*T:A=S:NEXT K
630 F=P*A
633 PRINT: PRINT
640 PRINT "For a Present Sum of $";P;"at an Annual Interest Rate of";R;"%  "
650 PRINT "for ";N;"Periods, where there are ";M;"Periods per Year:"
670 PRINT:PRINT "     The Future Value is $";F
680 PRINT "     The Increase is $";F-P;", or";(F/P)*100-100;"%"
683 PRINT: PRINT:
685 PRINT "WHAT DO YOU WANT TO DO: "
688 PRINT "     1 -- RETURN TO MAIN MENU"
690 PRINT "     2 -- RERUN CURRENT FUNCTION"
693 INPUT "          SELECT OPTION ==> ";IA
695 IF IA = 2 THEN GOTO 550
698 IF IA <>1 THEN GOTO 693
700 RUN
710 END
719 REM -----------------------------------------------------------------
720 DEFDBL I,T:C=0:P=0:L=0:R=0:M=0:CLS:AY=0:AT=0:YR=0
725 PRINT "     FUNCTION 1 -- AMORTIZATION SCHEDULE ": PRINT
727 PRINT"This function computes the Principal and Interest for a series of "
728 PRINT"payments over a given period at a specified Interest Rate.  If the"
730 PRINT"amount of the payment is not known, it will be calculated.":PRINT
735 INPUT "      PRINCIPAL  (DOLLARS AND CENTS)  " ;P
740 INPUT "      NUMBER OF PERIODS  (IN MONTHS)  " ;L
750 INPUT "      ANNUAL INTEREST RATE (PERCENT)  ";R
760 INPUT "      PAYMENT(IF KNOWN), THEN `ENTER' ";M
770 I=R/1200
780 T=1-1/(1+I)^L:K=P
790 IF M<>0 THEN GOTO 810
800 M=P*I/T
810 GOSUB 990
815 AY=0
820 FOR Z=1 TO L
830 IF C<12 GOTO 880
835 YR=YR+1
840 PRINT:PRINT "Year of Loan: ";YR;
845 PRINT "    $";K;" for ";L;"Months at";R;"%"
850 AT = AY +AT
853  PRINT"        Total Interest Paid during Year  ==> $";:PRINT USING "#,###,###.##";AY
855 AY = 0: PRINT
857 PRINT"SELECT OPTION:"
858 INPUT "     1 -- RETURN TO MAIN MENU   2 -- RERUN FUNCTION   3 -- CONTINUE   ==> ";CH
865 IF CH=1 THEN 10
866 IF CH=2 THEN 720
867 IF CH <> 3 THEN 858
870 C=0:GOSUB 990
880 A=P*I
890 A=INT(A*100+.5)/100
900 M=INT(M*100+.5)/100
910 B=M-A:P=P-B
920 B=INT(B*100+.5)/100
930 P=INT(P*100+.5)/100
935 AY = AY + A
940 PRINT USING "####    ";Z;:PRINT USING "###,###.##";P;M;B;A
950 IF  P<=0  THEN  955
953 C=C+1:NEXT Z
955 PRINT:PRINT "Year of Loan: ";YR+1;
956 PRINT "    $";K;" for ";L;"Months at";R;"%"
958  PRINT "        Total Interest Paid during Year ==> $";:PRINT USING "#,###,###.##";AY: AT=AY+AT
962  PRINT "        Total Interest Paid during Loan ==> $";:PRINT USING "#,###,###.##";AT
964 PRINT:
965 PRINT"SELECT OPTION:"
968 PRINT "     1 -- RETURN TO MAIN MENU";
970 PRINT "   2 -- RERUN CURRENT FUNCTION";"   ==> ";:INPUT IA
975 IF IA = 2 THEN GOTO 720
978 IF IA <>1 THEN GOTO 965
980 RUN
985 END
990 CLS: PRINT "     FUNCTION 1 -- AMORTIZATION SCHEDULE ": PRINT
1000 PRINT "PAYMENT  REMAINING   MONTHLY  PRINCIPAL INTEREST"
1010 PRINT "NUMBER   PRINCIPAL   PAYMENT   PAYMENT   PAYMENT
1020 RETURN
1029 REM -----------------------------------------------------------------
1030 CLS:PRINT "     FUNCTION 6 -- INTEREST RATE - COMPOUND INTEREST": PRINT: PRINT
1033 F=0: PRINT"This routine computes the annual interest rate for a specified Future Value,"
1034 PRINT"given the Present Value, the total period of time, and the number of periods." : PRINT: PRINT
1040 INPUT "     THE FUTURE VALUE (DOLLARS) ";FV
1050 IF F=4 THEN 1130
1060 INPUT "     THE PRESENT VALUE (DOLLARS)";PV
1070 IF F=3 THEN 1130
1080 INPUT "     NUMBER OF PERIODS PER YEAR ";PY
1090 IF F=5 THEN 1130
1100 PRINT "TOTAL LENGTH OF TIME FOR WHICH INTEREST IS TO BE FIGURED"
1120 INPUT "     USE THE FORMAT (YY,MM,DD)  ";Y,M,D
1130 PD=Y*PY+M*PY/12+D*PY/365
1140 I=((FV/PV)^(1/PD)-1)*100*PY
1150 A$="###.##":F=0
1155 CLS: PRINT "     FUNCTION 6 -- INTEREST RATE - COMPOUND INTEREST ":  PRINT
1160 PRINT: PRINT:PRINT "For a Future Sum of $";FV;"with a Present Value of $";PV;" with"
1170 PRINT PY;"Periods per Year, for ";Y;"Years,";M;"Months and";D;"Days"
1180 PRINT:PRINT "      The Annual Interest Rate is ";
1190 PRINT USING A$;I;:PRINT " %"
1200 PRINT:PRINT:PRINT "WHAT DO YOU WANT TO DO:"
1205 PRINT
1208 PRINT "     1 -- RETURN TO MAIN MENU"
1210 PRINT "     2 -- RERUN ENTIRE FUNCTION"
1215 PRINT "     3 -- CHANGE PRESENT VALUE"
1220 PRINT "     4 -- CHANGE FUTURE VALUE"
1230 PRINT "     5 -- CHANGE PERIODS PER YEAR
1240 PRINT "     6 -- CHANGE TIME RANGE
1270 PRINT:INPUT "          SELECT OPTION ==> ";F
1280 IF F<1 OR F>6 THEN 1160
1290 F=INT(F):ON F GOTO 10,1030,1060,1040,1080,1100
1300 GOTO 1200
1305 END
1309 REM -----------------------------------------------------------------
1310 CLEAR:F=0:CLS:DEFDBL I:A$="##.## %"
1315 PRINT "     FUNCTION 8 -- INTEREST RATE - INSTALLMENT LOAN": PRINT
1318 ON ERROR GOTO 5950
1320 PRINT"This routine computes the Interest Rate for an Installment Loan, given"
1321 PRINT"the loan duration, the number of payments per year, and the Payment Amount.
1325 PRINT
1330 INPUT "     PRESENT VALUE (DOLLARS)  "; PV
1340 IF F=3 GOTO 1420
1350 INPUT "     NUMBER OF TERMS PER YEAR ";NY
1360 IF F=5 GOTO 1420
1370 INPUT "     NUMBER OF PERIODS IN LOAN";N
1380 IF F=4 GOTO 1420
1390 INPUT "     AMOUNT OF EACH PAYMENT   ";P
1400 IF F=6 GOTO 1420
1410 CLS:PRINT:PRINT ". . . COMPUTER WORKING.  BE WITH YOU IN A FEW SECONDS . . ."
1420 I=8.000001E-03
1430 I1=P/PV*((1+I)^N-1)/(1+I)^N
1440 IF ABS(I-I1)<.000001 THEN 1470
1450 I=I1
1460 GOTO 1430
1470 I=I1*NY*100
1480 CLS:PRINT "     FUNCTION 8 -- INTEREST RATE - INSTALLMENT LOAN ": PRINT: PRINT
1490 PRINT "For a Loan with a Present Value of $";PV;" and "
1500 PRINT N;"Payments of $";P;", where there are";
1510 PRINT NY;"Payments per year"
1520 PRINT:PRINT "     the Annual Interest Rate is ";
1530 PRINT USING A$;I
1540 F=0:PRINT
1550 PRINT:PRINT "WHAT DO YOU WANT TO DO:"
1555 PRINT
1560 PRINT "     1 -- RETURN TO MAIN MENU"
1570 PRINT "     2 -- RERUN ENTIRE FUNCTION"
1580 PRINT "     3 -- CHANGE LOAN VALUE"
1590 PRINT "     4 -- CHANGE NUMBER OF INTEREST PERIODS"
1600 PRINT "     5 -- CHANGE PERIODS PER YEAR
1610 PRINT "     6 -- CHANGE PAYMENT AMOUNT
1620 PRINT:INPUT "          SELECT OPTION ==> ";F
1630 IF F<1 OR F>6 THEN 1620
1640 F=INT(F):ON F GOTO 10,1310,1330,1370,1350,1390
1650 GOTO 1550
1660 END
1669 REM -----------------------------------------------------------------
1670 CLS: PRINT "     FUNCTION 2 -- DAYS BETWEEN DATES": PRINT: PRINT
1675 CH=0: PRINT"This routine computes the Total Number of Days between two dates.":PRINT: PRINT
1680 PRINT "USING THE FORMAT  (MM,DD,YYYY):
1690 INPUT "     ENTER THE EARLIEST DATE ";M,D,Y:GOSUB 1870
1700 N=M:F=D:Z=Y:E=T
1710 IF CH=1 GOTO 1740
1720 INPUT "     ENTER THE LATEST DATE   ";M,D,Y:GOSUB 1870
1730 P=M:G=D:W=Y:L=T
1740 IF E>L THEN PRINT:PRINT "ERROR: CHECK THE DATES AND TRY AGAIN":GOTO 1780
1750 O=L-E
1760 PRINT:PRINT "The Total Number of Days between ";N;"/";F;"/";Z;
1770 PRINT " and  ";P;"/";G;"/";W;"is"
1775 PRINT:PRINT "    ";O;" Days "
1780 CH=0:PRINT:PRINT:PRINT "WHAT DO YOU WISH TO DO:"
1790 PRINT "     1 -- RETURN TO MAIN MENU"
1800 PRINT "     2 -- RERUN CURRENT FUNCTION": PRINT
1830 INPUT "          SELECT OPTION ==> ";IA
1840 IF IA = 2 THEN GOTO 1670
1850 IF IA <>1 THEN GOTO 1830
1860 RUN
1865 END
1870 YY=Y-1:T=365*YY+FIX(YY/4)-FIX(YY/100)+FIX(YY/400)
1880 CD=30*(M-1)+FIX((M-1)/3)+D
1890 IF M=2 OR M=9 OR M>10 THEN CD=CD+1:GOTO 1910
1900 IF M>2 AND M<8 AND M<>6 THEN CD=CD-1
1910 IF M<3 OR Y<>4*FIX(Y/4) THEN 1930
1920 IF Y=400*FIX(Y/400) OR Y<>100*FIX(Y/100) THEN CD=CD+1
1930 T=T+CD:RETURN
2219 REM -----------------------------------------------------------------
2220 CLS:PRINT "     FUNCTION 9 -- PRESENT VALUE OF A SERIES OF PAYMENTS":PRINT:PRINT
2222 F=0
2225 PRINT:PRINT "This program determines the Present Value of a series of payments."
2230 PRINT "It is normally used to determine the amount remaining on a loan, "
2240 PRINT "given the amount of the regular payment, the number of remaining"
2250 PRINT "payments, the number of payments per year, and the interest rate."
2260 PRINT
2270 INPUT "     AMOUNT OF REGULAR PAYMENT ";PT
2280 IF F=3 GOTO 2340
2290 INPUT "     # OF REMAINING PAYMENTS   ";NP
2300 IF F=4 GOTO 2340
2310 INPUT "     # OF PAYMENTS PER YEAR    ";PY
2320 IF F=5 GOTO 2340
2330 INPUT "     THE ANNUAL INTEREST RATE  ";IR
2340 I=IR/100
2344 CLS:PRINT "     FUNCTION 9 -- PRESENT VALUE OF A SERIES OF PAYMENTS": PRINT: PRINT
2347 T1=1+(I/PY):T1=T1^NP:T1=1/T1:T1=1-T1
2350 PR=PT*PY*T1/I
2360 PRINT "For ";NP;" Payments of $";PT;",with ";PY; "Payments per Year, "
2370 PRINT "at an Annual Interest Rate of ";IR;"%";" the Original Principal"
2380 PRINT "(or Value of the Remaining Payments) is"
2390 PRINT:PRINT "     $";:PRINT USING "#,###,###.##";PR
2400 PRINT:PRINT "WHAT DO YOU WANT TO DO:"
2405 PRINT
2410 PRINT "     1 -- RETURN TO MAIN MENU"
2420 PRINT "     2 -- RERUN ENTIRE FUNCTION"
2430 PRINT "     3 -- CHANGE PAYMENT AMOUNT"
2440 PRINT "     4 -- CHANGE NUMBER OF PAYMENTS "
2450 PRINT "     5 -- CHANGE PAYMENTS PER YEAR
2460 PRINT "     6 -- CHANGE ANNUAL INTEREST RATE"
2470 PRINT:INPUT "          SELECT OPTION ==> ";F
2480 IF F<1 OR F>6 THEN 2470
2490 F=INT(F):ON F GOTO 10,2220,2270,2290,2310,2330
2495 GOTO 2400
2500 END
4219 REM -----------------------------------------------------------------
4220 CLEAR
4235 CLS: PRINT "     FUNCTION 7 -- NOMINAL AND EFFECTIVE INTEREST RATES":PRINT:PRINT
4240 PRINT "This program computes the Nominal and Effective Interest Rates when"
4245 PRINT"given the Future Value, Present Value, number of periods between the"
4260 PRINT "two, and the number of compounding periods per year.":PRINT
4280 INPUT "     FUTURE VALUE (DOLLARS)    ";FV
4290 INPUT "     PRESENT VALUE (DOLLARS)   ";PV
4300 INPUT "     TOTAL NUMBER OF PERIODS   ";NP
4310 INPUT "     NUMBER OF PERIODS PER YEAR";PY
4320 NR=(PY*((FV/PV)^(1/NP))-PY)*100
4330 ER=((FV/PV)^(PY/NP)-1)*100
4340 PRINT:PRINT "     The Nominal Rate is";NR;" %
4345 PRINT "     The Effective Rate is";ER;" %
4350 PRINT: PRINT:
4355 PRINT "WHAT DO YOU WANT TO DO: ": PRINT
4358 PRINT "     1 -- RETURN TO MAIN MENU"
4360 PRINT "     2 -- RERUN CURRENT FUNCTION": PRINT
4363 INPUT "          SELECT OPTION ==> ";IA
4367 IF IA = 2 THEN GOTO 4230
4370 IF IA <>1 THEN GOTO 4363
4373 RUN
4379 REM -----------------------------------------------------------------
4380 CLS: PRINT "     FUNCTION 12 -- INTERNAL RATE OF RETURN": PRINT: PRINT
4390 CLEAR
4400 PRINT "This function computes the Internal Rate of Return on an Investment,"
4410 PRINT "based on the Periodic Earnings of that Investment, and discounted for"
4420 PRINT "for the Present Value of the Expected Sales Price.": PRINT
4440 INPUT "     PURCHASE PRICE (INVESTMENT) ";PV
4450 INPUT "     THE EXPECTED SALE PRICE     ";FV
4455 INPUT "     THE TOTAL NUMBER OF PERIODS ";N
4460 INPUT "     NUMBER OF PERIODS PER YEAR  ";PY: PRINT
4480 DIM EP(N)
4490 FOR X=1 TO N:PRINT "     EARNINGS FOR PERIOD #";X;:INPUT EP(X):NEXT X
4500 PRINT: PRINT
4505 PRINT"   . . . COMPUTER WORKING.  BE WITH YOU IN A FEW SECONDS . . .
4510 IR=.15/PY:I1=.25
4520 PF=FV/(1+IR)^N
4530 TE=0
4540 FOR X=1 TO N
4550 PE=EP(X)/(1+IR)^X
4560 TE=TE+PE
4570 NEXT X
4580 I1=IR*(PF+TE)/PV
4590 IF ABS(IR-I1)<.000001 THEN IR=IR*PY*100:GOTO 4603
4600 IR=I1:GOTO 4520
4603 CLS: PRINT "     FUNCTION 12 -- INTERNAL RATE OF RETURN": PRINT: PRINT
4608 PRINT "For an Investment of $";PV;", an Expected Sales Price of $";FV
4610 PRINT"and ";N;"periods, where there are ";PY;"periods per year:"
4613 PRINT:PRINT "     The Rate of Return is ";IR;"%"
4614 PRINT: PRINT:
4616 PRINT "WHAT DO YOU WANT TO DO: ": PRINT
4618 PRINT "     1 -- RETURN TO MAIN MENU"
4620 PRINT "     2 -- RERUN CURRENT FUNCTION": PRINT
4622 INPUT "          SELECT OPTION ==> ";IA
4624 IF IA = 2 THEN GOTO 4380
4625 IF IA <>1 THEN GOTO 4622
4627 RUN
4628 END
4629 REM -----------------------------------------------------------------
4630 CLS: PRINT "     FUNCTION 10 -- FUTURE VALUE OF REGULAR DEPOSITS": PRINT: PRINT
4633 CLEAR:PRINT "This function computes the Future Value of a Series of Regular Deposits,"
4650 PRINT "where each deposit is identical, and interest is compounded with the same "
4670 PRINT "frequency that the deposits are made.  This is known as an Annuity Due;"
4680 PRINT "that is, payments are made in advance of the interest being paid, such as
4700 PRINT "savings accounts or insurance policies.
4705 PRINT
4710 INPUT "     AMOUNT OF REGULAR DEPOSIT   ";RD
4720 INPUT "     NUMBER OF DEPOSITS PER YEAR ";PY
4730 INPUT "     THE TOTAL NUMBER OF MONTHS  ";M
4750 Y = M/12
4760 INPUT "     NOMINAL ANNUAL INTEREST RATE";IR
4770 I=IR/PY/100
4780 T=(1+I)^(PY*Y):T=T-1:T=T/I:FV=RD*T
4790 PRINT:PRINT "     The Future Value is $";:PRINT USING "#,###,###.##";FV
4793 PRINT: PRINT:
4795 PRINT "WHAT DO YOU WANT TO DO: ": PRINT
4798 PRINT "     1 -- RETURN TO MAIN MENU"
4800 PRINT "     2 -- RERUN CURRENT FUNCTION": PRINT
4803 INPUT "          SELECT OPTION ==> ";IA
4804 IF IA = 2 THEN GOTO 4630
4805 IF IA <>1 THEN GOTO 4803
4806 RUN
4809 END
4819 REM -----------------------------------------------------------------
4820 CLS: PRINT"     FUNCTION 11 -- REGULAR DEPOSITS FOR FUTURE VALUE":PRINT:PRINT
4823 PRINT "This program computes the Amount of Regular Deposits needed to produce a"
4840 PRINT "particular Future Value.  It is an example of an Annuity Due.":PRINT
4850 INPUT "     FUTURE VALUE (IN DOLLARS)   ";FV
4860 INPUT "     NUMBER OF DEPOSITS PER YEAR ";PY
4870 INPUT "     THE TOTAL NUMBER OF MONTHS  ";M
4890 Y = M/12
4900 INPUT "     NOMINAL ANNUAL INTEREST RATE";IR
4910 I=IR/PY/100
4920 T=(1+I)^(PY*Y):T=T-1:T=I/T:RD=FV*T
4930 PRINT:PRINT "     The Amount of the Regular Deposit is $";:PRINT USING "#,###,###.##";RD
4933 PRINT: PRINT:
4935 PRINT "WHAT DO YOU WANT TO DO: ": PRINT
4938 PRINT "     1 -- RETURN TO MAIN MENU"
4940 PRINT "     2 -- RERUN CURRENT FUNCTION": PRINT
4943 INPUT "          SELECT OPTION ==> ";IA
4944 IF IA = 2 THEN GOTO 4820
4945 IF IA <>1 THEN GOTO 4943
4946 RUN
4948 END
5589 REM -----------------------------------------------------------------
5590 CLS:PRINT "     FUNCTION 13 -- BOND - PRESENT VALUE": PRINT: PRINT
5591 ON ERROR GOTO 5950
5593 CLEAR:PRINT "This program determines the Present Value of a Coupon Bond at a specified"
5610 PRINT "Rate of Interest, given specific Financial Information on the Bond.":PRINT
5640 INPUT "     DESIRED RATE OF INTEREST (PERCENT)";IR
5650 INPUT "     FACE (REDEMPTION) AMOUNT OF BOND  ";AM
5660 INPUT "     NUMBER OF PAYMENT PERIODS PER YEAR";PY
5670 INPUT "     NUMBER OF PERIODS TO MATURITY     ";PN
5680 INPUT "     THE PERIODIC PAYMENT (IN DOLLARS) ";PP
5690 PRINT:PRINT
5700 IR=IR/PY/100:PV=AM/(1+IR)^PN
5710 T=(1+IR)^(-PN):T=1-T:T=T/IR:T=T*PP
5720 PV=PV+T
5723 PRINT "     The Present Value is $";:PRINT USING"###,###.##";PV
5730 PRINT: PRINT:
5733 PRINT "WHAT DO YOU WANT TO DO: ": PRINT
5735 PRINT "     1 -- RETURN TO MAIN MENU"
5738 PRINT "     2 -- RERUN CURRENT FUNCTION": PRINT
5740 INPUT "          SELECT OPTION ==> ";IA
5742 IF IA = 2 THEN GOTO 5590
5745 IF IA <>1 THEN GOTO 5740
5746 RUN
5748 END
5749 REM -----------------------------------------------------------------
5750 CLS:CLEAR
5755 PRINT "     FUNCTION 14 -- BOND - YIELD TO MATURITY": PRINT: PRINT
5760 ON ERROR GOTO 5950
5770 PRINT "This program determines the Yield to Maturity on a Bond, given the"
5780 PRINT "Current Purchase Price.  This is the true Rate of Return on a Bond."
5790 PRINT
5800 INPUT "      PURCHASE PRICE OF THE BOND    ";PV
5810 INPUT "      THE REDEMPTION (FACE) VALUE   ";FV
5820 INPUT "      ANNUAL QUOTED INTEREST RATE   ";IR
5830 INPUT "      # OF COUPON PAYMENTS PER YEAR ";PY
5840 INPUT "      # OF PAYMENT PERIODS REMAINING";N
5850 INPUT "      AMOUNT OF THE COUPON PAYMENT  ";CP
5860 PRINT:PRINT ". . . COMPUTER WORKING.  BE WITH YOU IN A FEW SECONDS . . .
5870 IR=.08/PY
5880 PF=FV/(1+IR)^N
5890 T=(1+IR)^(-N):T=1-T:T=T/IR*CP
5900 I1=IR*(PF+T)/PV
5910 IF ABS(IR-I1)<.000001 THEN IR=IR*PY*100:GOTO 5930
5920 IR=I1:GOTO 5880
5930 PRINT:PRINT "     The Yield to Maturity is";:PRINT USING A$;IR;" %"
5933 PRINT: PRINT:
5935 PRINT "WHAT DO YOU WANT TO DO: ": PRINT
5937 PRINT "     1 -- RETURN TO MAIN MENU"
5939 PRINT "     2 -- RERUN CURRENT FUNCTION": PRINT
5940 INPUT "          SELECT OPTION ==> ";IA
5942 IF IA = 2 THEN GOTO 5750
5945 IF IA <>1 THEN GOTO 5940
5946 RUN
5948 END
5949 REM -----------------------------------------------------------------
5950 REM          ERROR HANDLING ROUTINE
5955 PRINT
5960 IF ERR/2+1=11 THEN PRINT "A `DIVIDE BY ZERO' ERROR HAS OCCURRED."ELSE 6030
5970 PRINT:PRINT "     THIS USUALLY MEANS THAT A VALUE REQUIRED BY THE FUNCTION WAS NOT ENTERED PROPERLY"
5980 PRINT "     OR THAT AN INVALID ZERO CONDITION WAS COMPUTED."
5990 PRINT:PRINT "          PUSH `ENTER' TO RETURN TO MAIN MENU"; INPUT A$
6010 RUN
6030 PRINT "ERROR";ERR;"HAS OCCURR