1 REM STOKDIV1:7/22/80:REL 1.1
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$="          "
38 POKE 82,ZZ2:POKE 83,37
42 GRAPHICS ZZ0
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 GOSUB 300
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 100
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":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":? :GOSUB ZZ128:INPUT ZZQ1$
132 IF ZZQ1$<>"Y" THEN GRAPHICS ZZ0:TRAP 40000:END 
133 RESTORE :GOTO 90
135 SETCOLOR ZZ2,16,ZZ12:SETCOLOR ZZ4,13,ZZ6:SETCOLOR ZZ1,ZZ1,ZZ2:RETURN 
140 SETCOLOR ZZ2,13,ZZ2:SETCOLOR ZZ4,ZZ14,ZZ2:SETCOLOR ZZ1,ZZ0,ZZ12:RETURN 
145 SETCOLOR ZZ2,ZZ14,ZZ0:SETCOLOR ZZ4,ZZ14,ZZ8:SETCOLOR ZZ1,ZZ1,ZZ12:RETURN 
150 SETCOLOR ZZ2,ZZ9,ZZ2:SETCOLOR ZZ4,ZZ5,ZZ4:SETCOLOR ZZ1,ZZ0,ZZ12:RETURN 
155 SETCOLOR ZZ2,ZZ14,ZZ10:SETCOLOR ZZ4,ZZ14,ZZ0:SETCOLOR ZZ1,ZZ1,ZZ0:RETURN 
170 POSITION ZZ3,ZZ21:? ZZER$:ZZEFLG=ZZ1:? ZZBZ$:RETURN 
180 POSITION ZZ2,ZZ23:GOSUB 128:? "Type Ð to print, ÒÅÔÕÒÎ to continue";
181 OPEN #ZZ7,ZZ4,ZZ0,"K:ZZKK":GET #ZZ7,ZZDATA:CLOSE #ZZ7
182 IF ZZDATA=80 THEN TRAP 189:OPEN #ZZ5,ZZ8,ZZ0,"P:ZZPP":GOTO 186
183 IF ZZDATA<>155 THEN 180
184 GOSUB ZZ126:? ZZB$:RETURN 
186 FOR ZZJJ=ZZ1 TO 920:ZZJK=PEEK(ZZDIS+ZZJJ):IF ZZJK>127 THEN ZZJK=ZZJK-ZZ128
187 IF ZZJK>95 THEN ZZJK=ZZ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)<>2 AND A(0)<>3 THEN GOSUB ZZ170:GOTO 490
497 GOSUB 190
500 GOSUB 2050
502 POSITION ZZ29,ZZ9:INPUT A1:A(1)=A1
505 IF A(1)<=0 THEN GOSUB 170:GOTO 502
507 GOSUB 190
520 GOSUB 2100
525 POSITION ZZ29,11:INPUT A2:A(2)=A2:? 
526 IF A(2)<0 THEN GOSUB 170:GOTO 525
530 GOSUB 190
540 GOSUB 2150
541 POSITION ZZ29,ZZ14:INPUT A3:A(3)=A3
550 IF A(3)<0 THEN GOSUB 170:GOTO 541
555 GOSUB 190
560 GOSUB 2200
562 POSITION ZZ29,16:INPUT A4:A(4)=A4/100:? 
565 IF A(4)>1 OR A(4)<0 THEN GOSUB 170:GOTO 562
567 GOSUB 190
580 GOSUB 2250
582 POSITION ZZ29,19:INPUT A5:A(5)=A5/100
585 IF A(5)>1 OR A(5)<0 THEN GOSUB 170:GOTO 582
587 GOSUB ZZ190:GOSUB ZZ180:GOSUB 125
620 IF A(0)=2 THEN 740
630 GOSUB 2300
670 POSITION ZZ29,ZZ5:INPUT A6:A(6)=A6:? 
675 IF A(6)<>1 AND A(6)<>2 THEN GOSUB 170:GOTO 670
678 GOSUB 190
690 IF A(6)=1 THEN 740
700 GOSUB 2350
710 POSITION ZZ29,8:INPUT A8:A(8)=A8
720 IF A(8)<=0 THEN GOSUB 170:GOTO 710
730 GOSUB 190:GOTO 780
740 GOSUB 2400
745 POSITION ZZ29,8:INPUT A7:A(7)=A7/100
750 IF A(7)<A(4) THEN 758
752 POSITION ZZ3,ZZ21:? "ÅÒÒÏÒ-Must be less than discount."
755 ZZEFLG=ZZ1:? ZZBZ$:GOTO 745
758 GOSUB 190
780 GOSUB 2450
782 POSITION ZZ29,10:INPUT A9:A(9)=A9
785 IF A(9)<0 OR A(9)-INT(A(9))<>0 OR A9>9999 THEN GOSUB 170:GOTO 782
788 GOSUB 190:GOSUB 180
820 GT970=1
860 GOSUB 9990
862 TRAP 863:XIO 33,#1,0,0,"D:NK1D"
863 TRAP 40000:TRAP 110:OPEN #1,8,0,"D:NK1D":CLOSE #1
864 OPEN #1,9,0,"D:NK1D":FOR I=0 TO 8:? #1;A(I);",";:NEXT I:? #1;A(9);",";Q;",";GT970
865 CLOSE #1
880 RUN "D:STOKDIV2"
900 GOSUB 2000:POSITION ZZ29,7:? "?±"
950 GOSUB 2050:POSITION ZZ29,9:? "?³°²"
960 GOSUB 2100:POSITION ZZ29,11:? "?¶®¸µ"
970 GOSUB 2150:POSITION ZZ29,14:? "?·"
980 GOSUB 2200:POSITION ZZ29,16:? "?±¶"
990 GOSUB 2250:POSITION ZZ29,19:? "?´°"
1000 GOSUB 180
1010 GOSUB 2300:POSITION ZZ29,5:? "?±"
1030 GOSUB 2400:POSITION ZZ29,8:? "?µ"
1050 GOSUB 2450:POSITION ZZ29,10:? "?±¹·¶":GOSUB 180:RETURN 
2000 ? ZZB$:ZZ29=29
2010 POSITION ZZ2,ZZ1:? "Calculation wanted:":? :? "(1) Intrinsic value"
2020 ? "(2) Required duration of":? "    specific growth rate"
2030 ? "(3) Required future":? "    price/earnings ratio";:RETURN 
2050 POSITION ZZ2,ZZ9:? "Current market price   ($)";:RETURN 
2100 POSITION ZZ2,11:? "Current earnings/share ($)";:RETURN 
2150 POSITION ZZ2,13:? "Normalized earnings":? "this period            ($)";:RETURN 
2200 POSITION ZZ2,16:? "Long term discount rate(%)";:RETURN 
2250 POSITION ZZ2,18:? "Long term dividend":? "payout ratio           (%)";:RETURN 
2300 POSITION ZZ2,ZZ1:? "Forecast wanted":? :? "(1) Long term growth rate"
2310 ? "(2) Price/earnings ratio at":? "    future point in time":RETURN 
2350 POSITION 2,7:? "Price/earnings ratio at":? "future point":RETURN 
2400 POSITION 2,7:? "Long term growth rate":? " (percent)":RETURN 
2450 POSITION 2,10:? "Current year (e.g. 1969)":RETURN 
9000 POSITION 7,2:GOSUB 155:? "STOCK DIVIDEND ANALYSIS"
9010 POSITION 2,4:? "This program calculates the":? :? "intrinsic value of a stock, using"
9020 ? :? "the method of Nicholas Molodovsky.":? :? :? "The intrinsic value is the dis-":? 
9030 ? "counted present value of the stream":? :? "of dividends the shareholder":? 
9040 ? "expects to receive."
9050 GOSUB 180:POSITION 2,1:? "INPUTS":? :? 
9060 ? ".  Current earnings per share"
9070 ? :? ".  Earnings growth rates":? :? ".  Dividend payout rates":? 
9080 ? ".  Discount rates":? :? ".  Either":? :? "   .  Long term growth rate":? 
9090 ? "   .  Price/earnings ratio forecast"
9100 GOSUB 180:POSITION 2,1:? "OUTPUTS":? :? "To make the intrinsic value equal":? 
9110 ? "to the current market price, the":? :? "program calculates the following:":? 
9120 ? ".  The length of time a growth rate":? "   must persist":? 
9130 ? ".  The earnings ratio that must be":? "   achieved"
9150 ? :? :? "This is a modification of NICKMOL,":? "by D. Downes, Amos Tuck School":? "of Business."
9200 GOSUB 180:RETURN 
9990 GOSUB 150:? ZZB$:GOSUB 126:POSITION 7,22:? " ÌÏÁÄÉÎÇ ÔÈÅ ÎÅØÔ ÓÅÃÔÉÏÎ ":RETURN 
