|
- 1 REM BONDVAL2
- 5 CLEAR 1000
- 10 CLS:PRINT TAB(10);"VALUE OF A BOND":PRINT
- 20 PRINT"THIS PROGRAM SHOWS HOW THE VALUE OF A BOND MAY CHANGE
- 25 PRINT"WHEN THE INTEREST RATE CHANGES. WE ASSUME WE HAVE A BOND WITH
- 30 PRINT"A FIXED NUMBER OF YEARS TO MATURITY. FOR VARIOUS INTEREST
- 35 PRINT"RATES THE PRESENT VALUE OF THE FUTURE CASHFLOWS FROM THE
- 40 PRINT"BOND ARE DETERMINED. IT IS VERY INTERESTING TO SEE HOW MUCH
- 45 PRINT"THIS VARIES FOR LONG TERM BONDS.
- 90 PRINT:INPUT"PRESS ENTER TO BEGIN";Z9$
- 95 DIM A(15),I(15)
- 100 CLS
- 110 INPUT "NUMBER OF YEARS TO MATURITY ";N
- 120 INPUT "COUPON INTEREST PAYMENT PER YEAR ";C
- 130 INPUT "MATURITY VALUE OF THE BOND ";M
- 140 INPUT"LOWEST INTEREST RATE TO CONSIDER(%) ";L:L=L/100
- 150 INPUT"HIGHEST INTEREST RATE TO CONSIDER(%)";H:H=H/100
- 195 REM COMPUTING PV
- 197 K=0
- 200 FOR I=L TO H STEP (H-L)/10
- 205 K=K+1
- 210 I(K)=I:A(K)=C*(1-(1+I)[(-N))/I + M*(1+I)[(-N)
- 220 NEXT I
- 225 INPUT"DO YOU DESIRE LINE PRINTER OUTPUT(Y/N)";Z2$
- 230 CLS:PRINT"PRESENT VALUE OF BOND AT VARYING INTEREST RATES":PRINT
- 240 PRINT N;"YEARS TO MATURITY."
- 250 PRINT"COUPON PAYS $";C;" PER YEAR FOR INTEREST.
- 260 PRINT"MATURITY VALUE FOR THE BOND IS";M
- 262 IF Z2$="N" THEN GOTO 270
- 265 LPRINT N;"YEARS TO MATURITY."
- 266 LPRINT"COUPON PAYS $";C;" PER YEAR FOR INTEREST.
- 267 LPRINT"MATURITY VALUE FOR THE BOND IS";M
- 270 F$(1)= "INTEREST RATE VALUE OF BOND"
- 280 F$(2)= " ###.# ######.##
- 290 PRINT F$(1):IF Z2$="Y" THEN LPRINT F$(1):LPRINT" "
- 300 FOR K=1 TO 10:PRINT USING F$(2);100*I(K),A(K):NEXT
- 310 IF Z2$="Y" THEN FOR K=1 TO 10:LPRINT USING F$(2);100*I(K),A(K):NEXT
- 320 PRINT:INPUT"PRESS ENTER FOR MORE COMPUTATION";Z9$
- 325 IF Z9$ = "-1" THEN END
- 330 GOTO 100
|