10 DIM M#(72),M(72),T(39),A%(71),TITLE$(3),LABEL$(71),S(71),W(71),SV$(12)
20 LOCATE ,,0: YOPT=1: DEFINT I,J,K,L,O,X,Y
60 KEY OFF:FOR I=1 TO 10: KEY I,"": NEXT: ON KEY (9) GOSUB 740: KEY (9) ON
70 ON KEY (1) GOSUB 8000: REDO%=1: KEY (1) ON
80 ON KEY (3) GOSUB 9000
90 DEF SEG: POKE 106,0
100 ON ERROR GOTO 7000
200 CLS: LOCATE 12,35: PRINT "Bar Chart"
210 LOCATE 24,50: PRINT "Press space bar to continue."
220 K$=INKEY$: IF K$<>" " THEN 220
230 CLS: LOCATE 2,35:PRINT "Bar Chart":LOCATE 6,17:PRINT "1. On screens where an asterisk appears in":LOCATE 8,20:PRINT "the top right hand corner, the image":LOCATE 10,20:PRINT "will remain until the SPACE BAR is depressed."
240 LOCATE 14,17: PRINT "2. On all other screens, you will be prompted for ":LOCATE 16,20:PRINT "input. To use a FUNCTION KEY when input is expected,":LOCATE 18,20:PRINT "press the desired key followed by ENTER."
250 LOCATE 1,80:PRINT "*"
260 K$=INKEY$: IF K$<>" " THEN 260
270 CLS: LOCATE 2,35:PRINT "Bar Chart":LOCATE 20,17:PRINT "4. Press F9 (followed by enter) at any time":LOCATE 22,20:PRINT "to immediately exit the program.":LOCATE 6,17: PRINT "3. Press F1 (followed by enter) to return to":LOCATE 8,20
280 PRINT "the top of the nearest INPUT screen. This": LOCATE 10,20: PRINT "key should be used when a REDO FROM START":LOCATE 12,20: PRINT "or OVERFLOW message appears. It can also be ":LOCATE 14,20
290 PRINT "used at the beginning of the program to skip":LOCATE 16,20:PRINT "these introductory screens." :LOCATE 1,80:PRINT "*"
300 K$=INKEY$: IF K$<>" " THEN 300
310 CLS: LOCATE 10,39:PRINT "For":LOCATE 12,37:PRINT "SAMPLES":LOCATE 14,38:PRINT "Press":LOCATE 16,40:PRINT "F3":LOCATE 1,79:PRINT "*":KEY (3) ON
320 K$=INKEY$: IF K$<>" " THEN 320: ELSE KEY (3) OFF
400 REDO%=1: SAMPLE$="n":CLS:LOCATE 2,38:PRINT "MENU 1":LOCATE 6,1:PRINT "Select an option.
410 LOCATE 11,33: PRINT "1. RESTORE a file":LOCATE 13,33:PRINT "2. RUN from start":LOCATE 15,33:PRINT "3. List FILES"
420 LOCATE 17,33: IF OPT3=4 AND OP$<>"3" THEN PRINT "4. Return to MENU 3"
430 IF OP$="3" THEN PRINT "4. QUIT": SV$="3": ELSE SV$=""
440 LOCATE 6,19: INPUT OP$
450 IF OP$="2" THEN 530
460 IF OP$="3" THEN 4300
470 IF OP$="4" THEN IF SV$<>"3" AND OPT3<>4 THEN 440: ELSE IF SV$="3" THEN 740: ELSE 3800
480 IF OP$<>"1" THEN BEEP: GOTO 440
490 GOSUB 5700: LOCATE 23,1:PRINT "Enter the name under which the file was saved:"
500 LOCATE 23,60: INPUT FILE$: FOR K=1 TO LEN(FILE$): IF MID$(FILE$,K,1)="." THEN 510: ELSE NEXT
510 IF K>9 THEN K=9
520 OLDFILE$=LEFT$(FILE$,K-1): OLDFILE$=OLDFILE$+".bar": GOSUB 4600
530 IF OP$="2" THEN OPT3=0 :GOSUB 800
600 IF OPT=1 THEN GOSUB 900
610 IF OPT=2 THEN GOSUB 1100
620 IF OPT=3 THEN GOSUB 1500
630 IF OPT=4 THEN GOSUB 5000
640 GOSUB 1300
650 GOSUB 1700
660 GOSUB 1800
670 GOSUB 2400
680 IF OPT=1 THEN GOSUB 2800
690 IF OPT=2 THEN GOSUB 3000
700 IF OPT=3 THEN GOSUB 2900
710 IF OPT=4 THEN GOSUB 3200
720 GOSUB 3300
730 GOTO 3800
740 CLS: KEY 2,"run"+CHR$(13): END
800 REDO%=2:CLS:LOCATE 2,38:PRINT "MENU 2":LOCATE 6,1:PRINT "Select an option.":LOCATE 9,33:PRINT "1. Monthly Graph":LOCATE 11,33:PRINT "2. Quarterly Graph":LOCATE 13,33:PRINT "3. Yearly Graph":LOCATE 15,33:PRINT "4. Do-it-yourself Graph"
810 LOCATE 6,20:INPUT Z$ :IF VAL(Z$)<1 OR VAL(Z$)>4 THEN BEEP: GOTO 810: ELSE OPT=VAL(Z$)\1
815 QOPT$="":YRS=0:PRCENT$="y"
820 RETURN: '****************************************************************
900 REDO%=3: CLS
910 LOCATE 1,37: PRINT "MONTHLY"
920 LOCATE 6,1:PRINT "Enter the last month and year for which data will be entered.":LOCATE 8,1:PRINT "(Use format mm,yyyy)"
930 LOCATE 8,61: INPUT Z1$,Z2$: IF VAL(Z1$)<1 OR VAL(Z1$)>12 THEN BEEP: GOTO 930:ELSE MTH%=VAL(Z1$)\1
940 IF VAL(Z2$)<1000 OR VAL(Z2$)>9999 THEN LOCATE 14,1: PRINT "The year must be between 1000 and 9999": BEEP: GOTO 930: ELSE YR=VAL(Z2$)\1
950 N=11:XL=59:W=3:S=2
960 LABEL$(0)="JAN":LABEL$(1)="FEB":LABEL$(2)="MAR":LABEL$(3)="APR":LABEL$(4)="MAY":LABEL$(5)="JUN":LABEL$(6)="JUL":LABEL$(7)="AUG":LABEL$(8)="SEP":LABEL$(9)="OCT":LABEL$(10)="NOV":LABEL$(11)="DEC"
970 FOR I=0 TO 11-MTH%: SV$(I)=LABEL$(I+MTH%):NEXT
980 FOR I=12-MTH% TO 11:SV$(I)=LABEL$(I-12+MTH%):NEXT
990 FOR I=0 TO 11:LABEL$(I)=SV$(I):NEXT: IF OP$="1" THEN RETURN
1000 REDO%=4:CLS: LOCATE 1,37: PRINT "MONTHLY":LOCATE 4,1:PRINT "For each month enter a number."
1010 FOR I=0 TO 11: LOCATE I+6,1: PRINT LABEL$(I);",";:IF I<12-MTH% THEN PRINT YR-1:ELSE PRINT YR
1020 NEXT: IF OPT4=2 THEN 1300
1030 RETURN 640: '************************************************************
1100 REDO%=5: CLS:LOCATE 2,38:PRINT "QUARTERLY":LOCATE 6,1:PRINT "The graph will display data for 1 to 3 years.":PRINT "If data for 2 or 3 years is entered,":PRINT "the bars can be plotted chronologically or grouped by quarters."
1110 LOCATE 11,1:PRINT "Enter the number of years for which data will be entered."
1120 LOCATE 11,73:INPUT Z$ :IF VAL(Z$)<1 OR VAL(Z$)>3 THEN BEEP: GOTO 1120: ELSE YRS=VAL(Z$)\1
1130 IF YRS=1 THEN Z$="":QOPT$="c":GOTO 1160:ELSE Z$=" last"
1140 LOCATE 14,1:PRINT "Enter C to display chronologically or G to display in groups.":
1150 LOCATE 14,73:INPUT QOPT$:IF QOPT$<>"c" AND QOPT$<>"g" THEN BEEP: GOTO 1150
1160 IF YRS=1 THEN X=14: ELSE X=17
1170 LOCATE X,1:PRINT "Enter the";Z$;" year for which data will be entered.":
1180 LOCATE X,70: INPUT Z$: IF VAL(Z$)<1000 OR VAL(Z$)>9999 THEN BEEP: LOCATE X+4,1:PRINT "The year must be between 1000 and 9999":GOTO 1180:ELSE YR=VAL(Z$)\1
1190 REDO%=6: CLS:LOCATE 1,36:PRINT "QUARTERLY":LOCATE 4,1:PRINT "For each quarter enter a number."
1200 K=-1:FOR I=1 TO YRS:FOR J=1 TO 4: K=K+1:LOCATE 6+K,1:PRINT USING "####"; YR+I-YRS;:PRINT " QTR";J:NEXT:NEXT:IF OPT4=2 THEN GOTO 1300
1210 N=YRS*4-1:IF QOPT$="c" THEN 1230
1220 IF YRS=2 THEN XL=63:S=10:W=6:GOTO 1250:ELSE XL=63:S=12:W=4:GOTO 1250
1230 IF YRS=1 THEN XL=61:S=4:W=12:GOTO 1250
1240 IF YRS=2 THEN XL=64:S=2:W=6:ELSE XL=60:S=1:W=4
1250 IF OP$="2" THEN RETURN 640: ELSE RETURN '*******************************
1300 I=-1:J=0
1310 I=I+1: K=I: L=17
1320 IF N>11 THEN K=I MOD (N+2)\2: IF I>=(N+1)/2 THEN L=57
1330 LOCATE 6+K,L,1: IF OPT4<>2 THEN INPUT Z$: M#(I)=VAL(Z$): ELSE PRINT M#(I): GOTO 1380
1340 IF ABS(M#(I))<1000000000000000# THEN 1380
1350 J=1
1360 BEEP: LOCATE 22,1:PRINT "Enter numbers no greater in absolute value "
1370 LOCATE 23,1:PRINT "than 999,999,999,999,999. Do not use commas.":IF J=2 THEN 1450:ELSE 1330
1380 IF I999999999999999# THEN J=2: GOTO 1360
1460 RETURN: '****************************************************************
1500 REDO%=7: CLS:LOCATE 1,38:PRINT "YEARLY":LOCATE 6,1:PRINT "Enter the number of years to be graphed": LOCATE 7,1: PRINT "(Minimum is 2, Maximum is 20)":LOCATE 9,1:PRINT "And the last year for which data will be entered."
1510 LOCATE 6,65: INPUT Z$: IF VAL(Z$)<2 OR VAL(Z$)>20 THEN 1510:ELSE N=VAL(Z$)\1-1
1520 LOCATE 9,65: INPUT Z$: IF VAL(Z$)>999 AND VAL(Z$)<10000 THEN YR=VAL(Z$):GOTO 1540
1530 LOCATE 13,1: PRINT "The year must be between 1000 and 9999": BEEP:GOTO 1520
1540 REDO%=8: CLS: LOCATE 1,38:PRINT "YEARLY":LOCATE 4,1:PRINT "For each year enter a number."
1550 I=-1
1560 I=I+1: K=I: L=1
1570 IF N>11 THEN K=I MOD (N+2)\2: IF I>=(N+1)/2 THEN L=40
1580 LOCATE 6+K,L:PRINT USING "####"; YR+I-N:IF I=16 THEN S=1:GOTO 1670
1610 IF 9<=N AND N<=15 THEN S=2
1620 IF N=12 OR N=11 THEN S=1: GOTO 1670
1630 IF N=7 THEN S=2:GOTO 1670
1640 IF 4<=N AND N<=6 THEN S=3:GOTO 1670
1650 IF N=8 THEN S=3:GOTO 1670
1660 IF 1<=N AND N<=3 THEN S=5:GOTO 1670
1670 W=S-1
1680 W=W+1: XL=1+(N+1)*W+S*N: IF XL+N+1<67 THEN 1680
1690 IF OP$="2" THEN RETURN 640: ELSE RETURN: '******************************
1700 REDO%=9: CLS: LOCATE 1,38: PRINT "TITLES"
1710 LOCATE 6,1:PRINT "Enter the title of the graph"
1720 LOCATE 7,1:PRINT "(maximum two lines of 80 characters)"
1730 LOCATE 14,1:PRINT "Enter the title of the vertical axis"
1740 LOCATE 9,1,1:INPUT TITLE$(1)
1750 LOCATE 10,1,1:INPUT TITLE$(2)
1760 LOCATE 16,1,1:INPUT TITLE$(3)
1770 IF OPT4=3 THEN 3900
1780 RETURN: '****************************************************************
1800 CLS: LOCATE 25,62: PRINT "Just a second...."
1810 I=-1:AVG#=0: MIN#=ABS(M#(0)): MAX#=ABS(M#(0))
1820 I=I+1:IF M#(I)>MAX# THEN MAX#=M#(I)
1830 IF M#(I)3 THEN 1900 :ELSE IF MIN#<0 OR AVG#=0 THEN PRCENT$="n": GOTO 4100:ELSE PRCENT$="y":SCALE$="":FOR K=0 TO N: M(K)=100*M#(K)/(AVG#*(N+1)):NEXT: MAX=100*MAX#/(AVG#*(N+1)): MIN=100*MIN#/(AVG#*(N+1))
1870 IF R$="n" THEN IF REF#>100 THEN REF=100: ELSE IF REF#<0 THEN REF=0: ELSE REF=REF#
1880 IF R$="y" THEN REF=100/(N+1)
1890 GOTO 2070
1900 IF R$="y" THEN REF#=AVG#
1910 ABMAX#=ABS(MAX#): IF ABS(MIN#)>ABMAX# THEN ABMAX#=ABS(MIN#)
1920 IF ABS(REF#)>ABMAX# THEN ABMAX#=ABS(REF#)
1930 IF ABMAX#>=.001 AND ABMAX#<1000 THEN 1980
1940 IF ABMAX#>=1000000! AND ABMAX# <1E+09 THEN 1990
1950 IF ABMAX#>=1000! AND ABMAX#<1000000! THEN 2010
1960 IF ABMAX#>=1E+09 AND ABMAX#<1E+12 THEN 2030
1970 IF ABMAX#>=1E+12 THEN 2050
1980 AVG=AVG#:REF=REF#:MIN=MIN#:MAX=MAX#:FOR I=0 TO N: M(I)=M#(I):NEXT:SCALE$="":GOTO 2070
1990 AVG=AVG#/1000000!:REF=REF#/1000000!:MIN=MIN#/1000000!:MAX=MAX#/1000000!:FOR I=0 TO N:M(I)=M#(I)/1000000!: NEXT
2000 SCALE$="(in millions)": GOTO 2070
2010 AVG=AVG#/1000:REF=REF#/1000!:MIN=MIN#/1000:MAX=MAX#/1000:FOR I=0 TO N:M(I)=M#(I)/1000: NEXT
2020 SCALE$="(in thousands)": GOTO 2070
2030 AVG=AVG#/1E+09:REF=REF#/1E+09:MIN=MIN#/1E+09:MAX=MAX#/1E+09: FOR I=0 TO N: M(I)=M#(I)/1E+09: NEXT
2040 SCALE$="(in billions)": GOTO 2070
2050 AVG=AVG#/1E+12:REF=REF#/1E+12:MIN=MIN#/1E+12:MAX=MAX#/1E+12: FOR I=0 TO N: M(I)=M#(I)/1E+12: NEXT
2060 SCALE$="(in trillions)": GOTO 2070
2070 IF YOPT<>2 THEN REF=CINT(REF)
2080 I=0: IF REF==MAX THEN I=37: JUMP!=(REF-MIN)/37: GOTO 2150
2110 I=I+2: A=MIN+((MAX-MIN)/38)*(I-2): B=MIN+((MAX-MIN)/38)*I
2120 IF A<=REF AND REF<=B THEN I=I-1: GOTO 2130: ELSE 2110
2130 A=(MAX-REF)/(38-I): B=(REF-MIN)/I
2140 IF A>=B THEN JUMP!=A:ELSE JUMP!=B
2150 IF YOPT=2 THEN 2180:ELSE IF JUMP!<.25 THEN JUMP!=.25
2155 SV=JUMP!: J!=INT(JUMP!)-.25
2160 J!=J!+.25: IF SV>J! THEN JUMP!=J!+.25: IF J!=.5*(T(32)+T(31)) THEN J=31: GOTO 2270
2240 IF M(I)>=.5*(T(24)+T(23)) THEN J=23: GOTO 2270
2250 IF M(I)>=.5*(T(16)+T(15)) THEN J=15: GOTO 2270
2260 IF M(I)>=.5*(T(8)+T(7)) THEN J=7
2270 J=J+1: IF M(I)>=.5*(T(J)+T(J-1)) THEN A%(I)=J: ELSE 2290
2280 IF J<38 THEN 2270
2290 IF I"y" THEN 2450
2430 DOT$="": FOR I=1 TO XL: DOT$=DOT$+CHR$(249): NEXT:
2440 FOR I=5 TO 23: LOCATE I,YAX+1: PRINT DOT$;: NEXT
2450 I=4: IF 1=XAXIS MOD 2 THEN I=3
2460 I=I+2:J=39-2*(I-4): IF T(J)>=0 THEN 2510
2470 LOCATE I,YAX-7:IF T(J)<=-1000 OR YOPT<>2 THEN PRINT USING "+####.";T(J): LOCATE I,YAX-2: IF YOPT<>3 THEN PRINT ".";:GOTO 2550: ELSE PRINT "%";: GOTO 2550
2480 IF T(J)<=-100 AND T(J)>-1000 THEN PRINT USING "+###.#";T(J):GOTO 2550
2490 IF T(J)>-100 AND T(J)<=-10 THEN PRINT USING "+##.##";T(J):GOTO 2550
2500 PRINT USING "+#.###";T(J):GOTO 2550
2510 LOCATE I,YAX-6:IF T(J)>=1000 OR YOPT<>2 THEN PRINT USING "####.";T(J): LOCATE I,YAX-2: IF YOPT<>3 THEN PRINT ".";:GOTO 2550: ELSE PRINT "%";: GOTO 2550
2520 IF T(J)>=100 AND T(J)<1000 THEN PRINT USING "###.#";T(J):GOTO 2550
2530 IF T(J)<100 AND T(J)>=10 THEN PRINT USING "##.##";T(J):GOTO 2550
2540 PRINT USING "#.###";T(J)
2550 IF I<22 THEN 2460
2560 K=0
2570 K=K+1
2580 I=LEN(TITLE$(K)): J=(82-I)\2: IF YAXSV<8 THEN J=J+YAXSV\2
2590 IF J<1 THEN J=1
2600 LOCATE K,J:PRINT TITLE$(K)
2610 IF K=1 GOTO 2570
2620 I=LEN(TITLE$(3)):J=(2*YAX+1-I)\2:IF J<1 THEN J=1
2630 IF SCALE$="" THEN 2650
2640 LOCATE 3,J:PRINT TITLE$(3):LOCATE 4,YAX-6:PRINT SCALE$:GOTO 2660
2650 LOCATE 4,J:PRINT TITLE$(3)
2660 FOR J=YAX TO XL+YAX:LOCATE XAXIS,J
2670 PRINT CHR$(196);:NEXT
2680 FOR I=5 TO 23:LOCATE I,YAX
2690 PRINT CHR$(197):NEXT
2700 IF XTIC=1 THEN LOCATE 23,YAX:PRINT CHR$(192)
2710 IF XTIC=37 THEN LOCATE 5,YAX: PRINT CHR$(218)
2720 RETURN '************************************************************
2800 LOCATE 24,YAX+1:FOR I=0 TO 11:PRINT LABEL$(I)+" ";:NEXT:LOCATE 24,XL+YAX+2:IF MTH%=12 THEN PRINT YR;:ELSE PRINT " "+RIGHT$(STR$(YR-1),2);"-";RIGHT$(STR$(YR),2);
2810 RETURN 720 '**********************************************************
2900 IF W>4 THEN W1=(W-4)\2: ELSE W1=0
2910 FOR I=0 TO N :J=YAX+W1+(W+S)*I+1: LOCATE 24,J: IF N>13 THEN PRINT RIGHT$(STR$(YR+I-N),2);: ELSE PRINT RIGHT$(STR$(YR+I-N),4);
2920 NEXT: RETURN 720 '***************************************************
3000 IF QOPT$="g" THEN 3060
3010 IF YRS<>1 THEN 3030
3020 FOR I=1 TO 4: J=YAX+1+16*(I-1): LOCATE 24,J+7:PRINT RIGHT$(STR$(YR),4);:LOCATE 24,J+1:PRINT "QTR";:LOCATE 24,J+4: PRINT I;:LOCATE 24,J+6: PRINT ",";:NEXT:GOTO 3110
3030 IF YRS<>2 THEN 3050
3040 K=-1: FOR I=0 TO 1: FOR J=1 TO 4: K=K+1: L=YAX+8*K:LOCATE 24,L+5: PRINT RIGHT$(STR$(YR-1+I),2);:LOCATE 24,L:PRINT J;:LOCATE 24,L+2: PRINT "QTR";:NEXT:NEXT: GOTO 3110
3050 K=-1: FOR I=0 TO 2: FOR J=1 TO 4: K=K+1: L=YAX+5*K:LOCATE 24,L+3: PRINT RIGHT$(STR$(YR-2+I),2);: LOCATE 24,L:PRINT J;:LOCATE 24,L+2:PRINT "Q";:NEXT:NEXT: GOTO 3110
3060 IF YRS<>2 THEN 3090
3070 FOR I=0 TO 1:FOR J=1 TO 4
3080 L=(YAX+7*I)+16*(J-1):LOCATE 24,L+5:PRINT RIGHT$(STR$(YR-1+I),2);:LOCATE 24,L:PRINT J;:LOCATE 24,L+2:PRINT "QTR";:NEXT:NEXT:GOTO 3110
3090 FOR I=0 TO 2:FOR J=1 TO 4:L=(YAX+5*I)+16*(J-1)
3100 LOCATE 24,L+3:PRINT RIGHT$(STR$(YR-2+I),2);: LOCATE 24,L:PRINT J;:LOCATE 24,L+2:PRINT "Q";:NEXT:NEXT
3110 RETURN 720 '***********************************************************
3200 X=YAX+1: FOR J=0 TO N: X=X+S(J)+W(J): Y=X+(W(J+1)-LEN(LABEL$(J)))\2
3210 LOCATE 24,Y: PRINT LABEL$(J);:NEXT: RETURN '****************************
3300 L=0: X9=YAX+1: IF QOPT$="g" THEN N=3
3310 L=L+1:IF YRS=2 THEN X9=YAX+1+(L-1)*7
3320 IF YRS=3 THEN X9=YAX+1+(L-1)*5
3330 IF OPT=4 AND DOOP$="2" THEN Y=YAX+1+S(0)
3340 I=-1
3350 I=I+1:P%=I+(L-1)*4
3360 IF OPT=4 AND DOOP$="2" THEN W=W(I+1): IF I>0 THEN Y=Y+S(I)+W(I)
3370 IF A%(P%)=XTIC THEN 3660
3380 IF XTIC=1 AND A%(P%)=0 THEN 3660
3390 IF XTIC=37 AND A%(P%)=38 THEN 3660
3400 IF OPT=4 AND DOOP$="1" THEN S=S(1):W=W(1)
3410 IF OPT<>4 OR DOOP$<>"2" THEN Y=X9+(W+S)*I
3420 IF XTIC>A%(P%) THEN 3550
3430 IF 1=A%(P%) MOD 2 THEN 3500
3440 X=(40-A%(P%))/2+4
3450 FOR J=Y TO Y+W-1
3460 LOCATE XAXIS,J: PRINT CHR$(223)
3470 FOR K=X TO XAXIS-1: LOCATE K,J:PRINT CHR$(219)
3480 NEXT:NEXT
3490 GOTO 3660
3500 X=(39-A%(P%))/2+4
3510 FOR J=Y TO Y+W-1
3520 LOCATE XAXIS,J: PRINT CHR$(223): LOCATE X,J: PRINT CHR$(220)
3530 FOR K=X+1 TO XAXIS-1: LOCATE K,J: PRINT CHR$(219):NEXT:NEXT
3540 GOTO 3660
3550 IF 1=A%(P%) MOD 2 THEN 3620
3560 X=(38-A%(P%))/2+4
3570 FOR J=Y TO Y+W-1
3580 LOCATE XAXIS,J: PRINT CHR$(220)
3590 FOR K=XAXIS+1 TO X: LOCATE K,J:PRINT CHR$(219)
3600 NEXT:NEXT
3610 GOTO 3660
3620 X=(39-A%(P%))/2+4
3630 FOR J=Y TO Y+W-1
3640 LOCATE XAXIS,J: PRINT CHR$(220): LOCATE X,J: PRINT CHR$(223)
3650 FOR K=XAXIS+1 TO X-1: LOCATE K,J: PRINT CHR$(219):NEXT:NEXT
3660 '
3670 IF I" " THEN 3710
3720 IF SAMPLE$="y" THEN GOTO 9010
3730 RETURN: '***************************************************************
3800 REDO%=10: CLS:OPTF$="0": LOCATE 2,38:PRINT "MENU 3":LOCATE 6,1:PRINT "Select an option."
3810 LOCATE 8,33:PRINT "1. Return to GRAPH": LOCATE 10,33:PRINT "2. PRINT Graph":LOCATE 12,33: PRINT "3. STORE Input":LOCATE 14,33:PRINT "4. Return to MENU 1":LOCATE 16,33: PRINT "5. Y-AXIS Options":LOCATE 18,33: PRINT "6. Display Other OPTIONS"
3820 LOCATE 6,20: INPUT Z$: IF VAL(Z$)<1 OR VAL(Z$)>6 THEN BEEP: GOTO 3820: ELSE OPT3=VAL(Z$)\1
3830 ON OPT3 GOTO 670,670,3840,400,4100,3900
3840 LOCATE 22,1: PRINT "Enter the name under which the file shall be saved."
3850 LOCATE 22,55:INPUT DATUM$: FOR K=1 TO LEN(DATUM$):IF MID$(DATUM$,K,1)="." THEN 3860: ELSE NEXT
3860 IF K>9 THEN K=9
3870 DATUM$=LEFT$(DATUM$,K-1): NEWFILE$=DATUM$+".bar": GOSUB 4200
3880 GOSUB 5700: LOCATE 22,1:PRINT "The file named ";DATUM$;" has been saved.": LOCATE 6,20: PRINT " ": GOTO 3820
3890 '***************************************************************
3900 REDO%=11: KEY (1) ON: CLS:OPT4=0: G$="n": LOCATE 2,38:PRINT "MENU 4":LOCATE 6,1:PRINT "Select an option."
3910 LOCATE 9,28:PRINT "1. Change HORIZONTAL AXIS":LOCATE 11,28:PRINT "2. Display DATA": LOCATE 13,28: PRINT "3. Change TITLES":LOCATE 17,28:PRINT "5. Display GRAPH":LOCATE 19,28:PRINT "6. Return to MENU 3"
3920 LOCATE 15,28:IF GRID$<>"y" THEN PRINT "4. Add GRID Lines":ELSE PRINT "4. Delete GRID Lines"
3930 LOCATE 6,20: INPUT Z$: IF VAL(Z$)<1 OR VAL(Z$)>6 THEN BEEP: GOTO 3930:ELSE OPT4=VAL(Z$)
3940 ON OPT4 GOTO 3950,5500,1700,4060,670,3800
3950 GOSUB 4050
3960 IF R$="y" THEN R$="n": GOTO 4010
3970 LOCATE 23,1: GOSUB 5900
3980 IF R$="y" THEN 4030
3990 IF R$<>"n" THEN BEEP: GOTO 3970
4000 GOSUB 4050
4010 LOCATE 23,1:PRINT "Enter the value of the horizontal axis.";
4020 LOCATE 23,50:INPUT Z$: REF#=VAL(Z$) :IF REF#>=1D+16 THEN BEEP: GOTO 4020
4030 GOSUB 1860: GOSUB 4050
4040 LOCATE 23,1:PRINT "Anything else?":LOCATE 6,21:PRINT " ";: GOTO 3930
4050 LOCATE 23,1:FOR J=1 TO 19:PRINT " ";:NEXT: RETURN
4060 IF G$="n" THEN IF GRID$<>"y" THEN GRID$="y":ELSE GRID$="n"
4070 G$="y": GOTO 4040 '*****************************************************
4100 REDO%=14: CLS: SV=YOPT: LOCATE 2,37:PRINT "Y-AXIS":LOCATE 6,1:PRINT "Select an option.":LOCATE 8,1:PRINT "This option determines how the tick values":LOCATE 9,1:PRINT "are calculated. The default option is 1"
4110 LOCATE 14,28:PRINT "1. INTEGERS (rounding occurs)":LOCATE 16,28:PRINT "2. EXACT (to four digits)":LOCATE 18,28:PRINT "3. PERCENTAGES (rounded to integers)":GOSUB 5800
4120 LOCATE 6,20:INPUT Z$: IF VAL(Z$)<1 OR VAL(Z$)>3 THEN BEEP: GOTO 4120: ELSE YOPT=VAL(Z$)
4130 GOSUB 5800: IF PRCENT$="n" AND YOPT=3 THEN 4120:ELSE IF SV=YOPT THEN 3800: ELSE GOSUB 1810: GOTO 3800
4200 OPEN NEWFILE$ FOR OUTPUT AS #1:KEY (1) STOP: KEY (9) STOP
4210 PRINT#1,N,MTH%,YR,YRS,OPT,REF#,YOPT,DUMMY1,DUMMY2,
4220 FOR I=0 TO N: PRINT#1,M#(I),:NEXT
4230 IF OPT<>4 THEN 4250
4240 FOR I=0 TO N: PRINT#1,S(I),W(I+1):NEXT
4250 PRINT#1,TITLE$(1);",";TITLE$(2);",";TITLE$(3);",";QOPT$;",";R$;",";DOOP$;",";GRID$;",";DUMMY1$;",";DUMMY2$
4260 IF OPT<>4 THEN 4280
4270 FOR I=0 TO N: PRINT#1,LABEL$(I);",";:NEXT
4280 CLOSE #1: KEY (9) ON: KEY (1) ON: RETURN '*****************************
4300 REDO%=12: CLS: LOCATE 2,38:PRINT "FILES":LOCATE 4,1:PRINT "Select an option.":LOCATE 6,1:PRINT "1. Return 2. Erase
4310 LOCATE 10: FILES "*.bar"
4320 LOCATE 4,20:INPUT OPTF$: IF OPTF$<>"1" AND OPTF$<>"2" THEN BEEP: GOTO 4320
4330 IF OPTF$="1" THEN 400: ELSE 4400 '********************************
4400 REDO%=13: GOSUB 4500: LOCATE 5,1: PRINT "Enter the name of the file to be erased "
4410 LOCATE 5,42:INPUT GONE$: IF GONE$="/" THEN 400
4420 FOR K=1 TO LEN(GONE$):IF MID$(GONE$,K,1)="." THEN 4430: ELSE NEXT
4430 IF K>9 THEN K=9
4440 GONE$=LEFT$(GONE$,K-1): GONER$=GONE$+".bar": KILL GONER$: GOTO 4400
4450 LOCATE 6,30:PRINT "This name must be on the list.":GOTO 4410
4500 LOCATE 3,1: FOR K2=1 TO 20: PRINT " ";:NEXT:RETURN
4600 OPEN OLDFILE$ FOR INPUT AS #1
4610 IF EOF(1) THEN CLOSE: GOTO 4710
4620 INPUT#1,N,MTH%,YR,YRS,OPT,REF#,YOPT,DUUMY1,DUMMY2
4630 FOR I=0 TO N: INPUT#1,M#(I):NEXT
4640 IF OPT<>4 THEN 4660
4650 FOR I=0 TO N: INPUT#1,S(I),W(I+1):NEXT
4660 IF EOF(1) THEN 4700
4670 INPUT#1,TITLE$(1),TITLE$(2),TITLE$(3),QOPT$,R$,DOOP$,GRID$,DUMMY1$,DUMMY2$
4680 IF OPT<>4 THEN 4700
4690 FOR I=0 TO N: INPUT#1,LABEL$(I):NEXT
4700 CLOSE #1
4710 IF OPT=4 THEN GOSUB 5480
4720 IF OPT=1 THEN GOSUB 950
4730 IF OPT=2 THEN GOSUB 1210
4740 IF OPT=3 THEN GOSUB 1590
4750 RETURN 660: '***********************************************************
4800 FOR I=1 TO 25:FOR J=1 TO 80: X=SCREEN (I,J)
4810 IF I=1 AND J=80 THEN X=160
4820 IF X<192 THEN 4900
4830 IF X=218 THEN X=200
4840 IF X=192 THEN X=170
4850 IF X=196 THEN X=172
4860 IF X=197 THEN X=206
4870 IF X=223 THEN X=175
4880 IF X=219 THEN X=223
4890 IF X=249 THEN X=32
4900 LPRINT CHR$(X);:NEXT:NEXT: IF SAMPLE$="y" THEN RETURN 9010: ELSE RETURN 730: '*********************************************
5000 REDO%=15: CLS:LOCATE 2,34:PRINT "Do-It-Yourself":LOCATE 6,1:PRINT "Select an option.":LOCATE 10,22:PRINT "1. Set constant bar width and spacing":LOCATE 12,22:PRINT "2. Enter widths and spaces individually"
5010 LOCATE 6,19: IF OPT4=2 THEN PRINT "? ";DOOP$: GOTO 5030
5020 INPUT DOOP$: IF DOOP$<>"1" AND DOOP$<>"2" THEN BEEP: GOTO 5010
5030 IF DOOP$="1" THEN LOCATE 16,1:PRINT "Enter the WIDTH (same for each bar)":LOCATE 18,1:PRINT "Enter the SPACE (between bars)": ELSE IF OPT4<>2 THEN 5200: ELSE 5130
5040 LOCATE 16,40:IF OPT4<>2 THEN INPUT Z$: IF VAL(Z$)<1 OR VAL(Z$)>71 THEN BEEP: GOTO 5040: ELSE W=VAL(Z$)\1: GOTO 5060
5050 PRINT W: GOTO 5060
5060 LOCATE 18,40:IF OPT4<>2 THEN INPUT Z$:IF VAL(Z$)<0 OR VAL(Z$)\1+W>71 THEN BEEP: GOTO 5060:ELSE S=VAL(Z$)\1: GOTO 5080
5070 PRINT S: GOTO 5130
5080 I=1
5090 I=I+1: IF W*I+S*(I-1)<=71 THEN 5090
5100 IMAX=I-1
5110 LOCATE 21,22: PRINT "The maximum number of bars will be";I-1
5120 LOCATE 23,22: PRINT "If more than this are needed, press Q."
5130 LOCATE 1,79: PRINT "*": K$=INKEY$: IF K$="q" AND OPT4<>2 THEN LOCATE 22,36:PRINT " ": LOCATE 1,79: PRINT " ";:GOTO 5040
5140 IF K$<>" " THEN 5130: ELSE IF OPT4=2 THEN 5510 '************************
5200 PAGE=0: L=0: SV%=L: RE16$="n"
5210 REDO%=16: CLS:PAGE=PAGE+1: IF RE16$="y" THEN PAGE=PAGE-1
5220 LOCATE 2,30:PRINT "Do-It-Yourself":LOCATE 5,5:PRINT "Label":LOCATE 5,34:PRINT "Value":IF DOOP$="2" THEN LOCATE 5,55:PRINT "Space":LOCATE 5,68:PRINT "Width";
5230 IF DOOP$="2" AND OPT4<>2 THEN LOCATE 23,1:PRINT "You have used ";:PRINT USING "###";L;:PRINT " of 71 print positions. There are ";:PRINT USING "###";71-L;:PRINT " remaining.";
5240 IF OPT4=2 THEN RETURN
5250 IF PAGE>1 THEN 5270
5260 I=-1
5270 IF RE16$="y" THEN I=(PAGE-1)*15-1: RE16$="n"
5280 I=I+1: IF DOOP$="1" AND I=IMAX THEN 5410
5290 IF L=71 THEN 5410
5300 IF I=PAGE*15 THEN I=I-1: SV%=L: GOTO 5210
5310 J=7-(PAGE-1)*15: LOCATE I+J,1:PRINT USING "##";I+1;:PRINT "."
5320 LOCATE I+J,5:INPUT LABEL$(I):IF LABEL$(I)="/" THEN 5410
5330 X=LEN(LABEL$(I)):IF X>26 THEN BEEP: GOTO 5320
5340 LOCATE I+J,34:INPUT Z$: M#(I)=VAL(Z$):IF ABS(M#(I))>999999999999999# THEN BEEP:GOTO 5340
5350 IF DOOP$="1" THEN Y=W: GOTO 5400
5360 LOCATE I+J,55:INPUT Z$: S(I)=VAL(Z$)\1:IF S(I)>70 OR S(I)<0 THEN BEEP :GOTO 5360: ELSE Y=S(I)
5370 L=L+Y:IF L>71 THEN L=L-Y: BEEP:GOTO 5360: ELSE GOSUB 5600
5380 LOCATE I+J,68:INPUT Z$: W(I+1)=VAL(Z$)\1 :IF W(I+1)>71 OR L+W(I+1)>71 THEN BEEP: GOTO 5380: ELSE IF W(I+1)<1 THEN L=L-Y:GOSUB 5600: GOTO 5320
5390 L=L+W(I+1): GOSUB 5600: Y=W(I+1)
5400 LABEL$(I)=LEFT$(LABEL$(I),Y): GOTO 5280
5410 N=I-1: IF N=-1 THEN 400: ELSE GOSUB 5700
5420 LOCATE 23,1: GOSUB 5900
5430 IF R$="y" THEN 5470
5440 IF R$="n" THEN GOSUB 5700 :ELSE BEEP: GOTO 5420
5450 LOCATE 23,1:PRINT "Enter the value of the horizontal axis.";
5460 LOCATE 23,50:INPUT Z$: REF#=VAL(Z$) :IF REF#>=1D+16 THEN BEEP: GOTO 5460
5470 IF DOOP$="2" THEN 5480: ELSE FOR I=1 TO N+1: W(I)=W: S(I)=S:NEXT: S(0)=0: W(0)=0
5480 XL=0: FOR I=0 TO N+1: XL=XL+S(I)+W(I):NEXT: XL=XL-S(N+1)
5490 IF OP$="1" OR SAMPLE$="y" THEN RETURN :ELSE RETURN 650 '***************
5500 KEY (1) OFF: IF OPT<>4 THEN 5570: ELSE 5000
5510 GOSUB 5200: IF PAGE>1 THEN 5530
5520 I=-1
5530 I=I+1:IF I<>PAGE*15 THEN 5550
5540 LOCATE 1,79: PRINT "*": K$=INKEY$: IF K$<>" " THEN 5540: ELSE IF I-1=N THEN 3900: ELSE : GOSUB 5210
5550 J=7-(PAGE-1)*15:LOCATE I+J,1:PRINT USING "##";I+1;:PRINT ".";:LOCATE I+J,7:PRINT LABEL$(I):LOCATE I+J,36:PRINT M#(I);:IF DOOP$="2" THEN LOCATE I+J,57:PRINT S(I);:LOCATE I+J,70: PRINT W(I+1);
5560 IF I" " THEN 5580: ELSE 3900 '************************
5600 LOCATE 23,15:PRINT USING "###";L;:LOCATE 23,52:PRINT USING "###";71-L;:RETURN '*********************************************************************
5700 LOCATE 22,1: FOR I=1 TO 19: PRINT " ";:NEXT: RETURN '***********
5800 IF PRCENT$="n" AND YOPT=3 THEN BEEP: LOCATE 22,1:PRINT "The PERCENTAGE option can be chosen only if all data":PRINT "is non-negative and the total is positive.";
5810 RETURN '***************************************************************
5900 INPUT "Display the data relative to the average value (Y or N) ";R$: IF R$="Y" THEN R$="y": ELSE IF R$="N" THEN R$="n"
5910 RETURN '****************************************************************
7000 IF ERR<>71 THEN 7020: ELSE CLS: BEEP:LOCATE 13,25:PRINT "Did you remove the diskette?": LOCATE 1,79: PRINT "*": IF REDO%=10 THEN 7120
7010 K$=INKEY$: IF K$<>" " THEN 7010: ELSE IF SAMPLE$="y" THEN RESUME 310: ELSE IF REDO%=13 THEN RESUME 4300: ELSE RESUME 400
7020 IF ERR<>62 THEN 7040: ELSE CLS: BEEP:LOCATE 10,20:PRINT "The file you have accessed can not be used.":LOCATE 12,20:PRINT "It probably wasn't stored during execution":LOCATE 14,20:PRINT "of this program. The disk might have been full,"
7030 LOCATE 16,20:PRINT "or this might be a bug.":LOCATE 1,79:PRINT "*":GOTO 7050
7040 IF SAMPLE$<>"y" THEN 7060: ELSE CLS: LOCATE 13,39:PRINT "Fin":LOCATE 1,79:PRINT "*":GOTO 7050
7050 K$=INKEY$: IF K$<>" " THEN 7050: ELSE RESUME 400
7060 IF REDO%=1 AND OP$="1" THEN BEEP:GOSUB 5700: LOCATE 23,1: PRINT "No file named ";FILE$;" has been saved.";: RESUME 440
7070 IF ERR=53 AND REDO%=13 THEN BEEP:RESUME 4450
7080 IF OP$="3" AND ERR=64 THEN BEEP:RESUME 4450
7090 IF ERR<>61 THEN 7100: ELSE CLS:BEEP:LOCATE 10,20:PRINT "The disk appears to be full.":LOCATE 12,20:PRINT "The file you have attempted to save might":LOCATE 14,20:PRINT "not have been completely stored.":LOCATE 1,78:PRINT "*" : GOTO 7120
7100 IF REDO%=10 AND OPT3=3 THEN LOCATE 23,48: PRINT "This name is invalid.";:BEEP:RESUME 3850
7110 IF ERR<>27 THEN 7130 ELSE CLS: BEEP:LOCATE 8,20:PRINT "Either your printer is not plugged in,":LOCATE 10,20:PRINT "not connected to the computer,":LOCATE 12,20:PRINT "out of paper, or worse....":LOCATE 1,79:PRINT "*"
7120 K$=INKEY$: IF K$<>" " THEN 7120: ELSE RESUME 3800
7130 IF REDO%=12 AND ERR=53 THEN BEEP:LOCATE 13,30:PRINT "No files have been stored.": LOCATE 1,79:PRINT "*": ELSE 7150
7140 K$=INKEY$: IF K$<>" " THEN 7140 ELSE RESUME 400
7150 IF ERR=24 THEN CLS: LOCATE 13,30:PRINT "Check your printer.": BEEP:LOCATE 1,79:PRINT "*":GOTO 7120
8000 IF REDO%>8 THEN 8020: ELSE IF REDO%>4 THEN 8010:ELSE IF REDO%=1 THEN RETURN 400: ELSE IF REDO%=2 THEN RETURN 800: ELSE IF REDO%=3 THEN RETURN 900: ELSE IF REDO%=4 THEN RETURN 1000
8010 IF REDO%=5 THEN RETURN 1100: ELSE IF REDO%=6 THEN RETURN 1190: ELSE IF REDO%=7 THEN RETURN 1500: ELSE IF REDO%=8 THEN RETURN 1540
8020 IF REDO%>12 THEN 8030: ELSE IF REDO%=9 THEN RETURN 1700: ELSE IF REDO%=10 THEN RETURN 3800: ELSE IF REDO%=11 THEN RETURN 3900: ELSE IF REDO%=12 THEN RETURN 4300
8030 IF REDO%=13 THEN RETURN 4400: ELSE IF REDO%=14 THEN RETURN 4100: ELSE IF REDO%=15 THEN RETURN 5000: ELSE IF REDO%=16 THEN RE16$="y": L=SV%: RETURN 5210
9000 KEY (3) OFF: SAMPLE$="y":Z$=""
9010 Z$=Z$+"s": OLDFILE$=Z$+".bar": GOTO 4600