10 REM   PROGRAM NAME:  STKGRPH.BAS
20 REM                  S$ array values represent:
30 REM    0 TO  48 = PRICE    49 = PRICE PAID     50 TO 59 = EPS
40 REM   60 TO 108 = P/E     109 = SHARES HELD  110 TO 119 = EPS
50 REM  120 TO 121 = NAME
60 REM
70 DIM S(61,1), A(19), P(59), N1$(36), S$(121), T(8)
80 PRINT "ENTER DATE (MM/DD/YY)"; : INPUT D$
90 PRINT CHR$(26); "STOCK CODE (0 to exit)"; : INPUT F$ : IF F$="0" THEN 790 
100 PRINT : PRINT :  PRINT "DO YOU WANT TO CREATE A NEW FILE? (Y / N)";
110 INPUT A$  :  IF A$<>"Y" THEN 140  
120 GOSUB 1140
130 GOTO 210
140 OPEN "I",#1,F$+".DAT" : FOR I = 0 TO 121 : INPUT#1,S$(I) : NEXT I : CLOSE#1
150 GOSUB 1080
160 PRINT : PRINT "DO YOU WANT TO UPDATE (Y / N)"; : INPUT A$ 
170 IF A$ <> "Y" THEN 210
180 FOR I = 0 TO 47 : S$(I) = S$(I+1) : S$(I+60) = S$(I+61) : NEXT I
190 PRINT : PRINT "WHAT IS CURRENT PRICE"; : INPUT S$(48)
200 PRINT : PRINT "WHAT IS CURRENT P/E  "; : INPUT S$(108) : GOTO 160
210 PRINT : PRINT "DO YOU HAVE A CORRECTION (Y / N)";
220 INPUT A$ : IF A$ <> "Y" THEN 250  
230 GOSUB 970
240 GOTO 210
250 PRINT : PRINT "DO YOU WANT TO ADJUST FOR A SPLIT (Y / N)"; : INPUT A$
260 IF A$ <> "Y" THEN 280      
270 GOSUB 1220
280 OPEN "O",#1,F$+".DAT" : FOR I = 0 TO 121 : PRINT#1, S$(I) : NEXT I : CLOSE#1
290 PRINT : PRINT "GRAPHS (Y / N)"; : INPUT A$ : IF A$ <> "Y" THEN 90
300 FOR I = 0 TO 59 : S(I,0)= VAL(S$(I)) : S(I,1) = VAL(S$(I+60)) : NEXT I
310 GOSUB 1020
320 GOSUB 800 
330 PRINT I1, U, L
340 FOR I = 29 TO 48
350 P(I) = I1 * (INT((S(I,0) + (I1 / 2)) / I1))
360 A(I-29) = I1 * (INT((A(I-29) + (I1 / 2)) / I1))  : NEXT I
370 U = I1 * (INT((U + (I1 / 2)) / I1))
380 L = I1 * (INT((L + (I1 / 2)) / I1))
390 S1 = I1 * (INT((S(49,0) + (I1 / 2)) / I1))
400 N1$ = S$(120) + S$(121)
410 C = INT(43 - (.5 * LEN(N1$)))
420 LPRINT TAB(C); S$(120); S$(121) : LPRINT : LPRINT TAB(38); D$ : LPRINT
430 LPRINT TAB(7);"* = PRICE    @ = 30 WK. MOVING AVG.    - = AVG. PUR. PRICE"
440 LPRINT : LPRINT TAB(7); "$$"
450 FOR I = U TO L STEP -I1 : LPRINT TAB(6); I; TAB(13);
460 FOR J = 29 TO 48 : N$ = "   "
470 IF S1 = I THEN N$ = "---"
480 IF P(J) = I THEN N$ = "  *"
490 IF A(J-29) = I THEN N$ = "  @"
500 IF P(J) <> A(J-29) THEN 520
510 IF P(J) = I THEN N$ = "  X"
520 LPRINT N$; : NEXT J : LPRINT TAB(74); I : NEXT I
530 LPRINT TAB(13); : FOR I = 1 TO 20 : LPRINT "---"; : NEXT I
540 LPRINT:LPRINT TAB(13); : FOR I = 1 TO 20 : LPRINT USING "###"; I; : NEXT I
550 LPRINT : LPRINT TAB(39); "WEEKS"
560 LPRINT : LPRINT : LPRINT TAB(8); "PRICE";
570 FOR I = 29 TO 48 : LPRINT USING "###"; VAL(S$(I)); : NEXT I 
580 LPRINT : LPRINT : LPRINT TAB(8); "P/E  ";
590 FOR I = 29 TO 48 : LPRINT USING "###"; VAL(S$(I+60));  :  NEXT I
600 LPRINT : LPRINT : IF S(49,1) = 0 THEN 670
610 M = INT((S(49,1) * (S(48,0) - S(49,0))) + .5)
620 LPRINT TAB(8); "AVERAGE PURCHASE PRICE = "; S(49,0)
630 LPRINT TAB(8); "NUMBER OF SHARES       = "; S(49,1)
640 LPRINT TAB(8); "TOTAL INVENTMENT       = "; S(49,0) * S(49,1)
650 LPRINT TAB(8); "PRESENT MARKET VALUE   = "; S(48,0) * S(49,1)
660 LPRINT TAB(8); "NET GAIN (LOSS)        = "; M
670 LPRINT : LPRINT : LPRINT TAB(21); "EARNINGS PER SHARE"
680 LPRINT : LPRINT  TAB(18); "1       2       3       4     TOTAL" : LPRINT
690 FOR I = 0 TO 8 STEP 2 : FOR J = 0 TO 1 : FOR K = 0 TO 1
700 T(I) = T(I) + S(50+I+J,K) : NEXT K : NEXT J
710 IF T(I) = 0 THEN 770 
720 LPRINT TAB(7); 1980 + (I / 2);
730 FOR J = 0 TO 1  : FOR K = 0 TO 1
740 LPRINT USING "#####.##"; S(50+I+J,K);
750 NEXT K : NEXT J
760 LPRINT USING "#####.##"; T(I) : T(I) = 0
770 NEXT I : LPRINT CHR$(12)
780 GOTO 90
790 STOP          
800 REM  SUBROUTINE TO DETERMINE GRAPH INCREMENTS
810 U = S(29,0) : L = S(29,0)
820 FOR I = 29 TO 49 : IF S(I,0) = 0 THEN 870
830 U1 = S(I,0) : L1 = S(I,0) 
840 IF U1 > U THEN U = U1
850 IF L1 < L THEN L = L1
860 NEXT I
870 FOR I = 0 TO 19 : U1 = A(I) : L1 = A(I)
880 IF U1 > U THEN U = U1
890 IF L > L1 THEN L = L1
900 NEXT I
910 R = U - L : I = R /30
920 I1 = .25 : IF I > .25 THEN I1 = .5
930 IF I > .5 THEN I1 = 1
940 IF I > 1  THEN I1 = 2
950 IF I > 2  THEN I1 = 5
960 RETURN
970 REM  SUBROUTINE TO CORRECT INDIVIDUAL RECORD
980 PRINT : PRINT "WHAT IS WEEK NUMBER"; : INPUT I
990 PRINT : PRINT "PRICE (0) OR P/E (1)"; : INPUT J
1000 PRINT : PRINT "CORRECT VALUE:"; : INPUT S$(I + (J*60)) : GOSUB 1080 
1010 RETURN
1020 REM SUBROUTINE TO COMPUTE 30 WEEK MOVING AVERAGE
1030 A(0) = 0
1040 FOR J = 0 TO 29 : A(0) = A(0) + S(J,0) : NEXT J
1050 FOR I = 1 TO 19 : A(I) = A(I-1) + S(I+29,0) - S(I-1,0)
1060 A(I-1) = A(I-1) / 30 : NEXT I : A(19) = A(19) / 30
1070 RETURN
1080 REM SUBROUTINE TO DISPLAY DATA
1090 PRINT : PRINT S$(120); S$(121) : PRINT
1100 FOR I = 0 TO 14.1 : FOR J = 0 TO 3 : J1 = INT(I + (J * 15))
1110 PRINT TAB(J*20); : PRINT USING "## "; J1; : PRINT S$(J1); "  "; S$(J1+60);
1120 NEXT J : PRINT : NEXT I
1130 RETURN
1140 REM  SUBROUTINE TO CREATE A NEW FILE
1150 PRINT : PRINT : PRINT TAB(23); "****************18****************18"
1160 PRINT "WHAT IS COMPANY NAME"; : INPUT S$(120)
1170 PRINT TAB(39); : INPUT S$(121) : PRINT TAB(23); S$(120); S$(121)
1180 FOR J = 0 TO 1 : PRINT : FOR I = O TO 59
1190 PRINT : PRINT I; J; : INPUT S$(I + (60 * J))
1200 NEXT I : PRINT : NEXT J : PRINT CHR$(26) : GOSUB 1080
1210 RETURN
1220 REM  SUBROUTINE TO ADJUST FOR SPLITS
1230 PRINT : PRINT "NEW SHARES ARE WORTH HOW MANY OF OLD"; : INPUT F2
1240 FOR I = 0 TO 59 : IF I > 9 THEN 1260  
1250 S = VAL(S$(110+I)) * F2  : S$(110+I) = STR$(S)
1260 S = VAL(S$(I)) * F2 : S$(I) = STR$(S) : NEXT I
1270 S = VAL(S$(109)) / F2 : S$(109) = STR$(S)
1280 GOSUB 1080
1290 RETURN
1300 END
$(I)) * F2 : S$(I) = STR$(S) : NEXT I
1270 S = VAL(S$(109)) / F2 : 