1 REM BOND PRICE:4/28/80:REL. 1.0
2 REM COPYRIGHT CONTROL DATA  1980
20 DIM ZZCP$(36)
30 ZZCP$="COPYRIGHT  CONTROL  DATA  1980"
31 ZZ0=0:ZZ1=1:ZZ2=2:ZZ3=3:ZZ4=4:ZZ5=5:ZZ6=6:ZZ10=10:ZZ14=14:ZZ21=21:ZZ125=125:ZZ126=126:ZZ180=180:ZZ200=200
32 ZZ7=7:ZZ8=8:ZZ9=9:ZZ12=12:ZZ20=20:ZZ22=22:ZZ128=128:ZZ150=150:ZZ170=170:ZZ190=190:ZZ23=23:ZZ764=764:ZZFF=255
33 ZZDIS=PEEK(106)*256-961
35 DIM ZZSP$(ZZ10),ZZB1$(ZZ1):ZZB1$="}":ZZSP$="          "
36 GOTO 41
37 FOR ZZINDX=ZZ1 TO 400:NEXT ZZINDX:RETURN 
38 POKE 82,ZZ2:POKE 83,37:RETURN 
41 GOSUB 38:GRAPHICS ZZ2+16:SETCOLOR ZZ4,ZZ9,ZZ2:PLOT ZZ6,ZZ5:? #ZZ6;"ATARI"
42 GOSUB 37:GOSUB 37:GRAPHICS ZZ0
46 GOSUB ZZ126:GOSUB ZZ150:? ZZB1$
60 POSITION ZZ6,ZZ2:? "A CONTROL DATA CORPORATION":? :? " ",ZZSP$;"tm":? " "," CYBERWARE":? :? 
61 ? "     Personal Computer Product":POSITION ZZ2,13
62 ? ZZSP$;"  ****  ****":? ZZSP$;" *****  *****":? ZZSP$;"******  ******":? ZZSP$;"***        ***"
63 ? ZZSP$;"***        ***":? ZZSP$;"******  ******":? ZZSP$;" *****  *****":? ZZSP$;"  ****  ****"
70 GOSUB 37:? ZZB1$:? :? "BOND PRICE AND INTEREST":? :? 
71 ? "This program computes the price":? :? "and interest for a bond."
80 DIM ZZER$(35),ZZQ1$(ZZ1),ZZQ2$(ZZ1),ZZB$(ZZ1)
82 ZZER$="ÅÒÒÏÒ - Invalid data. Resubmit it.":ZZB$="}":ZZEFLG=0:TRAP 110
83 DIM ZZBZ$(ZZ1):ZZBZ$=CHR$(253)
85 POSITION ZZ3,15:? ZZCP$:GOSUB ZZ180:GOSUB 300
90 ? ZZB$:GOSUB ZZ150:? :? "Type Ø if an expert user":? :? "     ÒÅÔÕÒÎ if a novice user":? 
91 GOSUB 128:INPUT ZZQ1$:IF ZZQ1$="X" THEN ? ZZB$:GOSUB 150:GOTO 450
100 GOSUB 140:? ZZB$:? "Type É for information about the":? "       program":? 
101 ? "     Ó for a Sample run":? :? "     ÒÅÔÕÒÎ to run a problem":? :GOSUB ZZ128
102 INPUT ZZQ2$:IF ZZQ2$="I" THEN GOSUB 155:? ZZB$:GOSUB 9000:GOTO 90
103 IF ZZQ2$="S" THEN ? ZZB$:GOSUB 145:GOTO 350
104 ? ZZB$:GOSUB ZZ150:GOTO 400
110 ZZGOTO=256*PEEK(187)+PEEK(186):ZZPEEK=PEEK(195):IF ZZPEEK=ZZ8 OR ZZPEEK=18 THEN GOSUB 170:TRAP 110:GOTO ZZGOTO
111 IF ZZPEEK<>ZZ3 AND ZZPEEK<>7 AND ZZPEEK<>11 THEN GOTO ZZGOTO
115 TRAP 110:? :? "ÅÒÒÏÒ - A result of a calculation   has exceeded the maximum allowable  value"
116 GOSUB ZZ180:GOTO 130
120 ? :? "The óèáäåä öáìõåó indicate those    that must be input by the user":? :RETURN 
125 POKE 752,ZZ0:RETURN 
126 POKE 752,ZZ1:RETURN 
128 POKE 764,255:GOSUB ZZ125:RETURN 
130 GOSUB 135:? ZZB$:? :? "End of problem"
131 ? :? "Type Ù to run another problem":? :? "     ÒÅÔÕÒÎ to exit to menu":? :GOSUB ZZ128:INPUT ZZQ1$
132 IF ZZQ1$<>"Y" THEN ? "}":TRAP 40000:POKE 752,1:POSITION 10,10:? " ÒÅÔÕÒÎÉÎÇ ÔÏ ÍÅÎÕ ":RUN "D:MENU"
133 RESTORE :GOTO 90
135 SETCOLOR ZZ2,16,ZZ12:SETCOLOR ZZ4,13,ZZ6:SETCOLOR ZZ1,ZZ1,ZZ2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
204 ZZLB=ZZR9-ZZ1-ZZR4:IF ZZR6>=ZZ0 THEN ZZLB=ZZLB+ZZ1
205 IF ZZLB>ZZ0 AND ABS(ZZR6)<ZZ1 THEN ZZLB=ZZLB-ZZ1:ZZR3=ZZR3*0.1
206 IF ZZLB>ZZ0 THEN FOR ZZI=ZZ1 TO ZZLB:? " ";:NEXT ZZI
207 ZZDPT=ZZR9+ZZ1:ZZLOP=ZZR2+ZZR9:IF ZZLB>ZZ0 THEN ZZLOP=ZZLOP-ZZLB:ZZDPT=ZZDPT-ZZLB
208 FOR ZZI=ZZ1 TO ZZLOP:IF ZZR6<ZZ0 AND ZZI=ZZ1 THEN ? "-";:GOTO 212
209 IF ZZI=ZZDPT THEN ? ".";
210 IF ZZLB<ZZ0 THEN ? "*";:GOTO 212
211 ZZR3=ZZR3*ZZ10:ZZINT=INT(ZZR3):ZZR3=ZZR3-ZZINT:? ZZINT;
212 NEXT ZZI:RETURN 
300 DIM A$(4),C$(1),T$(30),R$(80),R(15),S5$(5),X$(80),SP$(7)
310 DIM P1$(30),P2$(36),P3$(50),P4$(35),D1$(7),Q$(4),T1$(40),P5$(36)
312 D1$="    .  ":SP$="       "
315 P1$="Annual coupon (dollars)     "
320 P2$="Redemption price (dollars)  "
325 P3$="Maturity (years,months)     "
330 P4$="Yield to maturity (percent) "
335 P5$="Enter the following data items:":D1$="    .  ":S5$="     ":SP$="       "
340 X$="Enter annual coupon,price, maturity (y,m),and yield, separated by commas"
345 RETURN 
350 DATA 6,100,12,5,5.5
360 READ C,R,M1,M2,Y
370 ? ZZB$:GOSUB 145:GOSUB 120
380 ? P5$:? :? P1$;:? "¶":? :? P2$;:? "±°°":? :? P3$;:? "±²¬µ":? :? P4$;:? "µ®µ":? :GOTO 465
400 ? P5$:? 
410 POSITION 2,3:? P1$;:INPUT C:? 
415 GOSUB 190
420 POSITION 2,5:? P2$;:INPUT R:? 
425 GOSUB 190
430 POSITION 2,7:? P3$;:INPUT M1,M2:? 
435 GOSUB 190
440 POSITION 2,9:? P4$;:INPUT Y
445 GOSUB 190:GOTO 465
450 ? "Enter (separated by commas)":? :? SP$;"annual coupon":? :? SP$;"redemption price":? 
455 ? SP$;"maturity (y,m)":? :? SP$;"yield":? 
460 POSITION 8,12:INPUT C,R,M1,M2,Y
462 GOSUB 190
465 GOSUB 180:GOSUB 140:GOSUB 126
470 ? "Coupon        $";:ZZR1=C:ZZR8=2:ZZR9=7:GOSUB 200:? :? 
475 ? "Redemption    $";:ZZR1=R:GOSUB 200:? :? 
480 ? "Maturity       ";:ZZR1=M1:GOSUB 200:? " years"
485 ? "               ";:ZZR1=M2:GOSUB 200:? " months":? 
490 ? "Yield          ";:ZZR1=Y:GOSUB 200:? " percent":? :? :? :? 
495 Y=Y/100
500 IF M2>12 THEN M1=M1+1:M2=M2-12:GOTO 500
530 M3=M1*2+M2/6:M4=INT(M3):M5=M3-M4:X=C/2*(1-(1+Y/2)^(-M4)):V1=X/(Y/2):V2=R/(1+Y/2)^(M4)
590 Z=(V1+V2+C/2):B=(1+Y/2):P=Z/(B^M5)-(C/2)*(1-M5)
595 ? "Price         $";:ZZR1=P:ZZR8=2:ZZR9=7:GOSUB 200:? 
600 D=C/2*(1-M5)
640 ZZR1=D:ZZR8=2:ZZR9=7:? :? "Accrued":? "interest      $";:GOSUB 200
650 GOSUB 180:GOTO 130
690 END 
865 IF FLG<>0 THEN POSITION 1,21:? "œ":POSITION 2,6:FLG=0
9000 ? "BOND PRICE AND INTEREST":? :? "This program computes the price of":? :? "a bond, given that a buyer wishes a"
9010 ? :? "certain rate of return from the":? :? "bond.":? :? :? "The price is the present value of":? 
9020 ? "all future coupon payments plus the":? :? "redemption price minus the accrued":? 
9030 ? "interest. The program assumes that":? :? "all interest is paid semi-annually.":? 
9150 GOSUB 180:? "The interest due the previous":? :? "owner is a function of the time"
9160 ? :? "he has held the bond. In the":? :? "sample problem, the time to matur-":? 
9170 ? "ity is 12 years and 5 months.":? :? "Therefore, the last coupon must":? 
9180 ? "have been paid one month ago. The":? :? "sample problem shows one month":? 
9200 ? "interest due."
9210 GOSUB 180:? "If the purchase date":? :? "is a coupon date, the coupon due ":? 
9220 ? "immediately is assumed to be":? :? "received by the new owner."
9240 ? :? :? :? "This program is a modification of":? :? "BONDPR by Prof. J. Peter Williamson":? 
9250 ? "Amos Tuck School of Business"
9300 GOSUB 180:? "The user must supply the following":? :? "data. All must be numeric.":? :? 
9310 ? D1$;"Annual coupon payment":? SP$;"(dollars)":? 
9320 ? D1$;"Redemption price at maturity":? SP$;"(dollars)":? 
9330 ? D1$;"Time to maturity (Years and":? "       months)":? 
9340 ? D1$;"Desired yield (percent)"
9360 GOSUB 180:? "NOTE:":? :? 
9370 ? "When an input request requires":? :? "multiple values, the computer will":? 
9380 ? "continue to prompt (with a ?),":? :? "until it has received sufficient":? :? "values."
9390 GOSUB 180:RETURN 
