Statistical Process Control


Language: GWBasic.

Objective: Generation of Statistical Process Control Charts and Histograms.


***** Begin of Program Listing *****

100 DATAREV$ = "03/09/1991": ON ERROR GOTO 6570
110 CLS : KEY OFF: SCREEN 1: SCREEN 0: LOCATE 6
120 PRINT STRING$(40, "*"); : PRINT "*"; TAB(40); "*";
130 BF$ = "S.    P.    C.": PRINT "*"; TAB((40 - LEN(BF$)) / 2 + 1); BF$; TAB(40); "*"; : PRINT "*"; TAB(40); "*"; : PRINT "*"; TAB(40); "*";
140 BF$ = "Developed by:": PRINT "*"; TAB((40 - LEN(BF$)) / 2 + 1); BF$; TAB(40); "*"; : PRINT "*"; TAB(40); "*";
150 BF$ = "Antonio Augusto GORNI": PRINT "*"; TAB((40 - LEN(BF$)) / 2 + 1); BF$; TAB(40); "*"; : BF$ = "Osvaldo L. G. BRANCHINI": PRINT "*"; TAB((40 - LEN(BF$)) / 2 + 1); BF$; TAB(40); "*"; : PRINT "*"; TAB(40); "*";
160 BF$ = "Latest Revision: " + DATAREV$: PRINT "*"; TAB((40 - LEN(BF$)) / 2 + 1); BF$; TAB(40); "*"; : PRINT "*"; TAB(40); "*"; : PRINT STRING$(40, "*");
170 FOR I = 1 TO 75000!: NEXT I
180 SM = 1: GOSUB 4470
190  DIM ELIM(30), TB(30, 22), AM(100, 22), AMI(100, 22), A(22), FAX(40): REM ===> MATRIZ DE DADOS DE AMOSTRAS E SEUS ELEMENTOS.
200 READ KCONT
210 FOR I = 1 TO KCONT + 1: FOR J = 1 TO 6: READ TB(I, J): NEXT J: NEXT I
220 SCREEN 2: SCREEN 0: FLAGSAVE = 0: FLAGCALC = 0
230 VIEW PRINT 1 TO 24: CLS : BF$ = "STATISTICAL PROCESS CONTROL": PRINT TAB((80 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: PRINT : PRINT TAB(45); "by BRANCHINI & GORNI"
240 PRINT : PRINT : PRINT TAB(23); "Maximum Number of Samples  = 100"
250 PRINT TAB(23); "Maximum Number of Elements =  20": PRINT : PRINT : PRINT
260 LOCATE 10, 29: PRINT "<1> Data Input"
270 LOCATE 11, 29: PRINT "<2> Data Correction"
280 LOCATE 12, 29: PRINT "<3> Data Suppression"
290 LOCATE 13, 29: PRINT "<4> Data Saving"
300 LOCATE 14, 29: PRINT "<5> Output Control Chart"
310 LOCATE 15, 29: PRINT "<6> Frequency Distribution Determination"
320 LOCATE 16, 29: PRINT "<7> Data and Results Output "
330 LOCATE 17, 29: PRINT "<8> Graphical Output"
340 LOCATE 18, 29: PRINT "<9> End"
350 LOCATE 22, 29: INPUT "Your Choice"; ESC
360 IF ESC < 1 OR ESC > 9 THEN BEEP: CLS : GOTO 230
370 ON ESC GOTO 380, 930, 1110, 640, 1390, 5750, 2470, 2890, 2860
380 CLS : BF$ = "     DATA ENTRY     ": PRINT TAB((80 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: NX = 5: NY = 5: XA$ = "": YA$ = "": SM = 1
390 LOCATE 7, 33: PRINT "<1> New Data"
400 LOCATE 12, 33: PRINT "<2> More Data"
410 LOCATE 19, 33: INPUT "Your Choice"; ESCD
420 IF ESCD < 1 OR ESCD > 2 THEN BEEP: GOTO 380
430 IF FLAGSAVE = 0 THEN 460
440 VIEW PRINT 3 TO 24: CLS : BEEP: LOCATE 10: PRINT "Current Data "; : COLOR 31, 0: PRINT "Not"; : COLOR 7, 0: PRINT " Saved Yet!": COLOR 7, 0: LOCATE 14
450 INPUT "Continue (Y/N)"; BUF$: IF BUF$ <> "Y" AND BUF$ <> "y" THEN 230 ELSE VIEW PRINT 1 TO 24
460 FLAGCALC = 0: IF ESCD = 2 THEN NOFS = NEL ELSE NOFS = 0: FLAGSAVE = 0
470 CLS : BF$ = "     DATA ENTRY     ": PRINT TAB((80 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0
480 LOCATE 7, 33: PRINT "<1> Via Keyboard"
490 LOCATE 12, 33: PRINT "<2> Via Disk"
500 LOCATE 19, 33: INPUT "Your Choice"; ESC
510 IF ESC < 1 OR ESC > 2 THEN BEEP: GOTO 470
520 ON ESC GOTO 770, 530
530 REM ===> LEITURA DOS DADOS EM DISQUETE.
540 CLS : BF$ = "     DATA READING IN DISK     ": PRINT TAB((80 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: VIEW PRINT 3 TO 24
550 LOCATE 10: PRINT "File Name ( to List Directory)? ": PRINT : INPUT "", NARQ$
560 IF NARQ$ = "?" THEN PRINT : INPUT "Drive/Path"; BF$: PRINT : FILES BF$ + "*.CTR": PRINT : PRINT : INPUT "Press  to Continue...", R$: CLS : GOTO 550
570 NARQ$ = NARQ$ + ".CTR"
580 LOCATE 20: PRINT "Reading "; : COLOR 31, 0: PRINT NARQ$: COLOR 7, 0: IF ESCD = 2 THEN NOFS = NEL
590 OPEN "I", #1, NARQ$
600 INPUT #1, NEL, NEG, LSN, LIN
610 FOR JI = 1 TO NEL: FOR I = 1 TO NEG: INPUT #1, AM(JI + NOFS, I): NEXT I: NEXT JI
620 CLOSE #1: IF NOFS = 0 THEN FLAGSAVE = 0
630 NEL = NOFS + NEL: GOTO 230
640 REM ===> GRAVACAO DE DADOS EM DISQUETE.
650 CLS : BF$ = "     DATA SAVING IN DISK     ": PRINT TAB((80 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: VIEW PRINT 3 TO 24
660 IF NARQ$ <> "" THEN LOCATE 10: PRINT "Save in "; : COLOR 0, 7: PRINT NARQ$; : COLOR 7, 0: INPUT ""; BUF$: IF BUF$ = "Y" OR BUF$ = "y" THEN 700
670 LOCATE 10: PRINT "File Name ( to List Directory)? ": PRINT : INPUT "", NARQ$
680 IF NARQ$ = "?" THEN PRINT : INPUT "Drive/Path"; BF$: PRINT : FILES BF$ + "*.CTR": PRINT : PRINT : INPUT "Press  to Continue...", R$: CLS : GOTO 670
690 NARQ$ = NARQ$ + ".CTR"
700 LOCATE 20: PRINT "Saving "; : COLOR 31, 0: PRINT NARQ$: COLOR 7, 0
710 OPEN "O", #1, NARQ$
720 WRITE #1, NEL, NEG, LSN, LIN
730 FOR JI = 1 TO NEL: FOR I = 1 TO NEG: WRITE #1, AM(JI, I): NEXT I: NEXT JI
740 CLOSE #1: FLAGSAVE = 0
750 GOTO 230
760 REM ===> ENTRADA DE DADOS VIA TECLADO.
770 CLS : FLAGSAVE = 1: BF$ = "     INPUT VIA KEYBOARD     ": PRINT TAB((80 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: PRINT : PRINT : PRINT : IF ESCD = 2 THEN 800 ELSE NARQ$ = "": REM ===> ESCD=2 PARA ADICIONAR MAIS DADOS.
780 INPUT "Number of Elements of the Group"; NEG
790 PRINT : INPUT "Inferior of the Standard"; LIN: INPUT "Superior Limit of the Standard"; LSN: PRINT
800 FOR JI = NOFS + 1 TO 100
810 VIEW PRINT 3 TO 24: CLS
820 PRINT "Now Enter the Data of Sample "; : COLOR 15, 0: PRINT "#"; JI: COLOR 7, 0
830 PRINT
840 PRINT "===> Enter "; : COLOR 0, 7: PRINT ""; : COLOR 7, 0: PRINT " to Finish <===": VIEW PRINT 7 TO 24
850 FOR I = 1 TO NEG
860 BUF$ = STR$(JI): PRINT "AM("; RIGHT$(BUF$, LEN(BUF$) - 1); ","; : BUF$ = STR$(I): PRINT RIGHT$(BUF$, LEN(BUF$) - 1); ")"; : INPUT ""; BUF$
870 IF BUF$ = "END" OR BUF$ = "end" THEN NEL = JI - 1: GOTO 920 ELSE AM(JI, I) = VAL(BUF$)
880 PRINT
890 NEXT I: VIEW PRINT 1 TO 24
900 NEL = NEL + 1: REM *** NEL = NRO DE AMOSTRAS.
910 NEXT JI
920 CLS : GOTO 230
930 REM *** Data Correction
940 VIEW PRINT 1 TO 24: CLS : BF$ = "     DATA CORRECTION     ": PRINT TAB((80 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: VIEW PRINT 3 TO 24
950 LOCATE 8, 29: PRINT "<1> Inferior Standard Limit": PRINT : PRINT TAB(29); "<2> Superior Standard Limit": PRINT : PRINT TAB(29); "<3> Raw Data"
960 PRINT : PRINT TAB(29); "<4> Main Menu"
970 LOCATE 22, 29: INPUT "Your Choice"; OPC: IF OPC < 1 OR OPC > 5 THEN BEEP: GOTO 930
980 FLAGSAVE = 1: FLAGCALC = 0: ON OPC GOTO 990, 1010, 1030, 230
990 CLS : LOCATE 9: PRINT "Current Inferior Standard Limit: "; : COLOR 0, 7: PRINT LIN: COLOR 7, 0: LOCATE 13: INPUT "Correct Value"; BUF$: IF BUF$ <> "" THEN LIN = VAL(BUF$)
1000 GOTO 930
1010 CLS : LOCATE 9: PRINT "Current Superior Standard Limit: "; : COLOR 0, 7: PRINT LSN: COLOR 7, 0: LOCATE 13: INPUT "Correct Value"; BUF$: IF BUF$ <> "" THEN LSN = VAL(BUF$)
1020 GOTO 930
1030 CLS : LOCATE 7, 15: INPUT "Sample Number"; NAMT: PRINT : PRINT
1040 IF NAMT > NEL THEN BEEP: LOCATE 10, 15: PRINT "Sample Number "; : COLOR 31, 0: PRINT "does not Exists!": COLOR 7, 0: LOCATE 15, 15: PRINT "Press  to Continue..."; : INPUT "", BF$: GOTO 1030
1050 FOR I = 1 TO NEG
1060 LOCATE 10 + I, 12: BUF$ = STR$(NAMT): PRINT "Current AM("; MID$(BUF$, 2, LEN(BUF$) - 1); ","; : BUF$ = STR$(I): PRINT MID$(BUF$, 2, LEN(BUF$) - 1); "): "; AM(NAMT, I); : PRINT , "New Value"; : INPUT ""; BUF$
1070 IF BUF$ <> "" THEN AM(NAMT, I) = VAL(BUF$)
1080 NEXT I
1090 PRINT : PRINT : PRINT TAB(15); : INPUT "New Correction (Y/N)"; NC$
1100 IF NC$ = "Y" OR NC$ = "y" THEN 1030 ELSE CLS : GOTO 950
1110 REM ===> ELIMINACAO DE DADOS.
1120 CLS : BF$ = "     DATA SUPPRESSION     ": PRINT TAB((80 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: VIEW PRINT 3 TO 24: NELIM = 0
1130 LOCATE 7, 15: INPUT "Sample Number"; NAMT: PRINT
1140 IF NAMT > NEL THEN BEEP: LOCATE 10, 15: PRINT "Sample Number "; : COLOR 31, 0: PRINT "does not Exists!": COLOR 7, 0: LOCATE 15, 15: PRINT "Press  to Continue..."; : INPUT "", BF$: GOTO 1130
1150 FOR I = 1 TO NEG
1160 LOCATE 10 + I, 12: BUF$ = STR$(NAMT): PRINT "AM("; MID$(BUF$, 2, LEN(BUF$) - 1); ","; : BUF$ = STR$(I): PRINT MID$(BUF$, 2, LEN(BUF$) - 1); "): "; AM(NAMT, I)
1170 NEXT I
1180 PRINT : PRINT : PRINT TAB(15); : BEEP: COLOR 31, 0: PRINT "Confirm (Y/N)! "; : COLOR 7, 0: INPUT "", NC$
1190 IF NC$ = "Y" OR NC$ = "y" THEN NELIM = NELIM + 1: ELIM(NELIM) = NAMT ELSE 1130
1200 IF NELIM = 30 THEN 1230
1210 PRINT : PRINT TAB(15); "New Suppresion (Y/N)"; : INPUT ""; NC$
1220 IF NC$ = "Y" OR NC$ = "y" THEN CLS : GOTO 1130 ELSE IF NELIM = 0 THEN 230
1230 CLS : LOCATE 12: PRINT "Making Suppressions... Please Wait!": FLAGSAVE = 1: FLAGCALC = 0
1240 FOR I = 1 TO NELIM - 1: FOR J = I + 1 TO NELIM: IF ELIM(J) > ELIM(I) THEN SWAP ELIM(I), ELIM(J)
1250 NEXT J, I
1260 FOR COUNTER = 1 TO NELIM: NAMT = ELIM(COUNTER)
1270 FOR JI = 1 TO NAMT - 1
1280 FOR I = 1 TO NEG
1290 AMI(JI, I) = AM(JI, I)
1300 NEXT I: NEXT JI
1310 FOR JI = NAMT + 1 TO NEL
1320 FOR I = 1 TO NEG
1330 AMI(JI - 1, I) = AM(JI, I)
1340 NEXT I: NEXT JI
1350 NEL = NEL - 1
1360 FOR JI = 1 TO NEL: FOR I = 1 TO NEG
1370 AM(JI, I) = AMI(JI, I)
1380 NEXT I, JI, COUNTER: GOTO 230
1390 REM ===> CALCULO DE MEDIA, AMPLITUDE, MEDIA DAS MEDIAS E AMPLITUDES, LIMITES DE CONTROLE PARA ATENCAO E ACAO.
1400 CLS : BUF$ = "       DETERMINACAO DA CARTA DE CONTROLE       "
1405 PRINT TAB((80 - LEN(BUF$)) / 2 + 1); : COLOR 0, 7: PRINT BUF$: COLOR 7, 0
1407 VIEW PRINT 3 TO 24: LOCATE 7: INPUT "Do Your Want to Follow the  Statistical Calculations"; BUF$
1410 IF BUF$ = "Y" OR BUF$ = "y" THEN FLAGIMPR = 1 ELSE FLAGIMPR = 0
1420 CLS : LOCATE 9: PRINT "Cogito, Ergo Sum!": LOCATE 15: PRINT "This Can Take Some Time..."
1430 REM ===> CALCULO DE MEDIA GERAL PARA MATRIZ < 100.
1440 PROD = NEL * NEG
1450 IF PROD >= 100 THEN GOTO 1500
1460 MED = 0
1470 FOR I = 1 TO NEL: FOR J = 1 TO NEG: MED = MED + AM(I, J): NEXT J: NEXT I
1480 MED = MED / (NEL * NEG):
1490 GOTO 1590
1500 REM ===> CALCULO DA MEDIA DAS MEDIAS PARA MATRIZ >= 100.
1510 LET MED = 0
1520 FOR I = 1 TO NEL
1530 FOR J = 1 TO NEG
1540 MED = MED + AM(I, J)
1550 NEXT J
1560 AM(I, NEG + 1) = MED / NEG
1570 MED = 0
1580 NEXT I
1590 REM ===> ORDENACAO DOS RESULTADOS DE UMA AMOSTRA E CALCULO DO VALOR DE .
1600 FOR T = 1 TO NEL: FOR V = 1 TO NEG
1610 A(V) = AM(T, V)
1620 NEXT V
1630 FOR I = 1 TO NEG - 1
1640 IF A(I + 1) < A(I) THEN SWAP A(I), A(I + 1): CTRL = 1
1650 NEXT I
1660 IF CTRL = 1 THEN CTRL = 0: GOTO 1630
1670 AM(T, NEG + 2) = ABS(A(NEG) - A(1))
1680 NEXT T
1690 IF FLAGIMPR = 0 THEN 1750
1700 KK = 0: CLS : LOCATE 5: COLOR 0, 7: PRINT "Provisory Matrix": COLOR 7, 0: PRINT
1710 GOSUB 6540
1720 FOR JI = 1 TO NEL: KK = KK + 1: IF KK = 15 THEN PRINT : PRINT : KK = 0: INPUT "Press  to Continue...", BUF$: CLS : LOCATE 5: COLOR 0, 7: PRINT "Provisory Matrix - Continuation": COLOR 7, 0: PRINT : GOSUB 6540: GOTO 1730
1730 FOR I = 1 TO NEG + 2: PRINT TAB(7 * (I - 1) + 1); : PRINT USING "###.##"; AM(JI, I); : NEXT I: NEXT JI
1740 PRINT : PRINT : PRINT : INPUT "Press  to Continue...", BUF$
1750 MED1 = 0: MEDR = 0
1760 FOR JI = 1 TO NEL: MED1 = MED1 + AM(JI, NEG + 1): MEDR = MEDR + AM(JI, NEG + 2): NEXT JI
1770 MED1 = MED1 / NEL: MEDR = MEDR / NEL: IF PROD < 100 THEN MED1 = MED
1780 IF FLAGIMPR = 1 THEN CLS : LOCATE 7: PRINT "Med and  Means:", : PRINT USING "###.##"; MED1; : PRINT USING "###.##"; MEDR;
1790 AA1 = TB(NEG, 2): AA2 = TB(NEG, 3): DD3 = TB(NEG, 4): DD4 = TB(NEG, 5)
1800 LSC = MED1 + AA2 * MEDR
1810 LIC = MED1 - AA2 * MEDR
1820 LSA = MED1 + AA1 * MEDR
1830 LIA = MED1 - AA1 * MEDR
1840 IF FLAGIMPR = 0 THEN 1880
1850 PRINT : PRINT : PRINT : COLOR 0, 7: PRINT "Provisory Control Limits": COLOR 7, 0: PRINT
1860 PRINT "Superior Limit of Warning:"; TAB(35); LSC: PRINT "Inferior Limit of Warning:"; TAB(35); LIC: PRINT "Superior Limit of Control:"; TAB(35); LSA: PRINT "Inferior Limit of Control:"; TAB(35); LIA
1870 PRINT : PRINT : PRINT "Press  to Continue..."; : INPUT "",ESC$ : CLS : LOCATE 7 ELSE PRINT
1880 REM ===> CALCULO DOS LIMITES DE CONTROLE E RETIRADA DOS VALORES FORA DO INTERVALO. MONTAGEM DA MATRIZ AUXILIAR , CONTADORES  E , "FLAG"  QUE INDICA RETIRADA DE ALGUMA LINHA PARA MATRIZ => 100.
1890 IF PROD >= 100 THEN GOTO 2100
1900 FOR JI = 1 TO NEL: FOR I = 1 TO NEG
1910 IF AM(JI, I) > LSC OR AM(JI, I) < LIC THEN 1920 ELSE 1940
1920 RESTI = JI: KKL = 1: KKCONT = 1: FLAGSAVE = 1
1930 IF FLAGIMPR = 1 THEN PRINT "Element to be Deleted: AM("; : BUF$ = STR$(RESTI): PRINT MID$(BUF$, 2, LEN(BUF$) - 1); ","; : BUF$ = STR$(I): PRINT MID$(BUF$, 2, LEN(BUF$) - 1); ") = "; AM(RESTI, I): GOTO 1960
1940 NEXT I: NEXT JI
1950 IF KKL = 0 THEN GOTO 2060
1960 FOR AJI = 1 TO RESTI - 1: FOR I = 1 TO NEG + 2
1970 AMI(AJI, I) = AM(AJI, I): NEXT I: NEXT AJI
1980 FOR AJI = RESTI + 1 TO NEL: FOR I = 1 TO NEG + 2
1990 AMI(AJI - 1, I) = AM(AJI, I): NEXT I: NEXT AJI
2000 NEL = NEL - 1
2010 FOR EJI = 1 TO NEL: FOR I = 1 TO NEG + 2: AM(EJI, I) = AMI(EJI, I): NEXT I: NEXT EJI
2020 IF KKL = 1 THEN KKL = 0: IF FLAGIMPR = 1 THEN FOR I = 1 TO 1000: NEXT I
2030 GOTO 1900
2040 REM ===> RECALCULA LIMITES DE CONTROLE APOS ELIMINACAO DE DADOS FORA DO LIMITE.
2050 REM ===> VERIFICA SE APOS O CALCULO DOS LIMITES DE CONTROLE NAO HOUVE A RETIRADA DE NENHUM DADO. SE NAO HOUVE, A MATRIZ OBTIDA E' A FINAL. CASO CONTRARIO, RECALCULA-A NOVAMENTE.
2060 IF KKCONT = 0 THEN GOTO 2290
2070 KKCONT = 0
2080 IF NEL * NEG < 100 THEN GOTO 1430
2090 GOTO 1500
2100 REM ===> ELIMINACAO PARA MATRIZ => 100.
2110 FOR JI = 1 TO NEL
2120 IF AM(JI, NEG + 1) > LSC OR AM(JI, NEG + 1) < LIC THEN 2130 ELSE 2150
2130 FLAGSAVE = 1: RESTI = JI: KKL = 1: KKCONT = 1
2140 IF FLAGIMPR = 1 THEN PRINT "Value to be Deleted: AM("; : BUF$ = STR$(RESTI): PRINT MID$(BUF$, 2, LEN(BUF$) - 1); ","; : BUF$ = STR$(NEG + 1): PRINT MID$(BUF$, 2, LEN(BUF$) - 1); ") = "; AM(RESTI, NEG + 1): GOTO 2170
2150 NEXT JI
2160 IF KKL = 0 THEN GOTO 2260
2170 FOR AJI = 1 TO RESTI - 1: FOR I = 1 TO NEG + 2
2180 AMI(AJI, I) = AM(AJI, I): NEXT I: NEXT AJI
2190 FOR AJI = RESTI + 1 TO NEL: FOR I = 1 TO NEG + 2
2200 AMI(AJI - 1, I) = AM(AJI, I): NEXT I: NEXT AJI
2210 NEL = NEL - 1
2220 FOR EJI = 1 TO NEL: FOR I = 1 TO NEG + 2: AM(EJI, I) = AMI(EJI, I): NEXT I: NEXT EJI
2230 IF KKL = 1 THEN KKL = 0: IF FLAGIMPR = 1 THEN FOR I = 1 TO 300: NEXT I: GOTO 2110 ELSE 2110
2240 REM ===> RECALCULA LIMITES DE CONTROLE APOS ELIMINACAO DOS DADOS FORA DO LIMITE.
2250 REM ===> VERIFICA SE APOS O CALCULO DOS LIMITES DE CONTROLE NAO HOUVE A RETIRADA DE NENHUM DADO. EM CASO AFIRMATIVO, A MATRIZ OBTIDA E' A FINAL. CASO CONTRARIO, RECALCULA-A NOVAMENTE.
2260 IF KKCONT = 0 THEN GOTO 2290
2270 KKCONT = 0
2280 GOTO 1500
2290 FLAGCALC = 1: CLS : BEEP: LOCATE 5: COLOR 0, 7: PRINT "Results Matrix": COLOR 7, 0: KK = 0
2300 PRINT : GOSUB 6540
2310 FOR JI = 1 TO NEL: KK = KK + 1: IF KK = 15 THEN PRINT : KK = 0: PRINT : INPUT "Press  to Continue...", BUF$: CLS : LOCATE 5: COLOR 0, 7: PRINT "Results Matrix - Continuation": COLOR 7, 0: PRINT : GOSUB 6540: GOTO 2320
2320 FOR I = 1 TO NEG + 2: PRINT TAB(7 * (I - 1) + 1); : PRINT USING "###.##"; AM(JI, I); : NEXT I: NEXT JI
2330 PRINT : PRINT : INPUT "Press  to Continue...", PROS$: CLS
2340 LOCATE 4: PRINT "Means of Mean and R:", : PRINT USING "###.##"; MED1; : PRINT USING "###.##"; MEDR
2350 PRINT : PRINT : COLOR 0, 7: PRINT "Definitive Control Limits": COLOR 7, 0: PRINT
2360 LSC = MED1 + AA2 * MEDR: PRINT "Superior Limit of Warning: "; TAB(35); : PRINT USING "#####.##"; LSC
2370 LIC = MED1 - AA2 * MEDR: PRINT "Inferior Limit of Warning: "; TAB(35); : PRINT USING "#####.##"; LIC
2380 LSA = MED1 + AA1 * MEDR: PRINT "Superior Limit of Control: "; TAB(35); : PRINT USING "#####.##"; LSA
2390 LIA = MED1 - AA1 * MEDR: PRINT "Inferior Limit of Control:"; TAB(35); : PRINT USING "#####.##"; LIA
2400 PRINT : PRINT "Inferior Limit of Standard: "; : PRINT USING "#####.#"; LIN
2410 PRINT "Superior Limit of Standard: "; : PRINT USING "#####.#"; LSN
2420 PRINT : PRINT : PRINT "Final Mean: "; : PRINT USING "#####.##"; MED1
2430 PRINT "Final Mean Amplitude: "; : PRINT USING "#####.##"; MEDR
2440 PRINT "Number of Groups: "; : PRINT USING "#####"; NEL
2450 LOCATE 23: INPUT "Press  to Continue...", ESC$
2460 GOTO 230
2470 REM ===> IMPRESSAO DE DADOS E RESULTADOS.
2480 VIEW PRINT 1 TO 24: CLS : BUF$ = "     DATA AND RESULTS PRINTING ": PRINT TAB((80 - LEN(BUF$)) / 2 + 1); : COLOR 0, 7: PRINT BUF$: COLOR 7, 0
2490 LOCATE 8, 29: PRINT "<1> Raw Data ": PRINT : PRINT TAB(29); "<2> Statistical Process Control": PRINT : PRINT TAB(29); "<3> Frequency Distribution": PRINT : PRINT TAB(29); "<4> Main Menu"
2500 LOCATE 22, 29: INPUT "Your Choice"; ESC
2510 IF ESC < 1 OR ESC > 4 THEN BEEP: GOTO 2480
2520 ON ESC GOTO 2710, 2530, 6140, 230
2530 CLS : BUF$ = "     PRINTING OF THE RESULTS OF THE STATISTICAL PROCESS CONTROL ": PRINT TAB((80 - LEN(BUF$)) / 2 + 1); : COLOR 0, 7: PRINT BUF$: COLOR 7, 0
2540 IF FLAGCALC = 1 THEN 2570
2550 BEEP: LOCATE 9: PRINT "Data "; : COLOR 31, 0: PRINT "were not"; : COLOR 7, 0: PRINT " Statistically Processed Yet!": LOCATE 15: PRINT "Please Generate the S.P.C. Chart before Printing of Results."
2560 LOCATE 22: INPUT "Press  to Continue...", BUF$: GOTO 230
2570 LOCATE 9: PRINT "Identification Mensage to be Printed in the Report?": INPUT "", BUF$: LOCATE 15: INPUT "Prepare Printer and Press !", ESCC$
2580 LPRINT CHR$(14); "LIMITES DE CONTROLE": LPRINT : LPRINT BUF$: LPRINT
2590 IF NARQ$ = "" THEN LPRINT "Data Entered via Keyboard" ELSE IF FLAGSAVE = 0 THEN LPRINT "Dados from the File "; NARQ$ ELSE LPRINT "Data  from Keyboard and from the File "; NARQ$
2600 GOSUB 6550
2610 LPRINT "Superior Limit of Warning"; TAB(35); "= "; : LPRINT USING "####.#"; LSC
2620 LPRINT "Inferior Limit of Warning"; TAB(35); "= "; : LPRINT USING "####.#"; LIC
2630 LPRINT "Superior Limit of Control"; TAB(35); "= "; : LPRINT USING "####.#"; LSA
2640 LPRINT "Inferior Limit of Control"; TAB(35); "= "; : LPRINT USING "####.#"; LIA
2650 LPRINT : LPRINT "Superior Limit of Standard"; TAB(35); "= "; : LPRINT USING "####.#"; LSN
2660 LPRINT "Inferior Limit of Standard"; TAB(35); "= "; : LPRINT USING "####.#"; LIN
2670 LPRINT : LPRINT "Final Mean"; TAB(35); "= "; : LPRINT USING "####.#"; MED1
2680 LPRINT "Amplitude Mean "; TAB(35); "= "; : LPRINT USING "####.#"; MEDR
2690 LPRINT : LPRINT "Number of Groups"; TAB(35); "= "; : LPRINT USING "#####"; NEL
2700 LPRINT CHR$(12): CLS : GOTO 2480
2710 REM ===> IMPRESSAO DE DADOS.
2720 CLS : BUF$ = "     DATA PRINTING ": PRINT TAB((80 - LEN(BUF$)) / 2 + 1); : COLOR 0, 7: PRINT BUF$: COLOR 7, 0
2730 LOCATE 9: PRINT "Identification Message to be Printed at the Report?": INPUT "", BUF$: LOCATE 15: INPUT "Prepare Printer and Press !", ESCC$
2740 NPAGE = 1: LPRINT CHR$(14); "DATA MATRIX": LPRINT : LPRINT BUF$: LPRINT "Page #"; NPAGE: LPRINT
2750 IF NARQ$ = "" THEN LPRINT "Data Entered via Keyboard" ELSE IF FLAGSAVE = 0 THEN LPRINT "Data from the File "; NARQ$ ELSE LPRINT "Data from Keyboard and from the File "; NARQ$
2760 GOSUB 6550
2770 GOSUB 6560
2780 FOR JI = 1 TO NEL: KK = KK + 1: IF KK = 52 THEN LPRINT CHR$(12): NPAGE = NPAGE + 1: LPRINT BUF$: LPRINT "Page #"; NPAGE: LPRINT : LPRINT : GOSUB 6560
2790 FOR I = 1 TO NEG + 2: LPRINT TAB(7 * (I - 1) + 1); : LPRINT USING "###.##"; AM(JI, I); : NEXT I: NEXT JI
2800 MED1 = 0: MEDR = 0
2810 FOR JI = 1 TO NEL: MED1 = MED1 + AM(JI, NEG + 1): MEDR = MEDR + AM(JI, NEG + 2): NEXT JI
2820 MED1 = MED1 / NEL: MEDR = MEDR / NEL: IF PROD < 100 THEN MED1 = MED
2830 LPRINT : LPRINT : LPRINT "Med and R Mean:"; TAB(7 * (NEG) + 1); : LPRINT USING "###.##"; MED1; : LPRINT TAB(7 * (NEG + 1) + 3); MEDR
2840 LPRINT CHR$(12)
2850 CLS : GOTO 2480
2860 IF FLAGSAVE = 1 THEN BUF$ = "     END OF PROGRAM RUN     ": CLS : PRINT TAB((80 - LEN(BUF$)) / 2 + 1); : COLOR 0, 7: PRINT BUF$: COLOR 7, 0 ELSE 2880
2870 BEEP: LOCATE 10: PRINT "Current Data "; : COLOR 31, 0: PRINT "Not"; : COLOR 7, 0: PRINT " Saved Yet!": LOCATE 14: INPUT "Continue (Y/N)"; BUF$: IF BUF$ <> "Y" AND BUF$ <> "y" THEN 230
2880 ON ERROR GOTO 0: CLS : KEY ON: END
2890 SCREEN 0: VIEW PRINT 1 TO 24: CLS : BF$ = "PLOTTING OF RESULTS": PRINT TAB((80 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: VIEW PRINT 3 TO 24
2900 IF FLAGCALC <> 0 THEN 2930
2910 BEEP: LOCATE 9: PRINT "Data "; : COLOR 31, 0: PRINT "were not"; : COLOR 7, 0: PRINT " Processed Statistically Yet!": COLOR 7, 0
2915 LOCATE 15: PRINT "Please Generate the S.P.C. Chart before Plotting Graphics."
2920 LOCATE 22: INPUT "Press  to Continue...", BUF$: GOTO 230
2930 LOCATE 7, 28: PRINT "<1> Statistical Process Control"
2940 LOCATE 12, 28: PRINT "<2> Frequency Distribution"
2950 LOCATE 19, 28: INPUT "Your Choice"; ESCD
2960 IF ESCD < 1 OR ESCD > 2 THEN BEEP: GOTO 2950
2970 IF ESCD = 2 THEN FLAGRAF = 2 ELSE 3010
2980 IF FLAGCALC = 2 THEN 3100
2990 CLS : BEEP: LOCATE 9: PRINT "Frequency Distribution "; : COLOR 31, 0: PRINT "were not"; : COLOR 7, 0: PRINT " Determined Yet!": LOCATE 15: PRINT "Generate it before Plotting Graphics!"
3000 LOCATE 22: INPUT "Press  to Continue...", BUF$: GOTO 230
3010 X0 = 1: X1 = NEL: NX = 5: NY = 5: XA$ = "": YA$ = "": SM = 1
3020 VIEW PRINT 1 TO 24: CLS : BUF$ = "     STATISTICAL PROCESS CONTROL CHART ": PRINT TAB((80 - LEN(BUF$)) / 2 + 1); : COLOR 0, 7: PRINT BUF$: COLOR 7, 0: VIEW PRINT 3 TO 24
3030 LOCATE 7, 28: PRINT "<1> S.P.C. Calculated Limits"
3040 LOCATE 12, 28: PRINT "<2> Standard Limits"
3050 LOCATE 19, 28: INPUT "Your Choice"; ESCD
3060 IF ESCD < 1 OR ESCD > 2 THEN BEEP: GOTO 3050
3070 IF ESCD = 1 THEN FLAGRAF = 0 ELSE FLAGRAF = 1
3080 NY = 5: IF FLAGRAF = 0 THEN Y0 = LIA: Y1 = LSA ELSE Y0 = LIN: Y1 = LSN
3090 GOTO 3160
3100 X0 = LIH: X1 = LIH + INTFR * (NRFAX): Y0 = FAX(1) / NEL * 100: Y1 = Y0
3110 FOR I = 2 TO NRFAX: AUX = FAX(I) / NEL * 100
3120 IF Y0 > AUX THEN Y0 = AUX
3130 IF Y1 < AUX THEN Y1 = AUX
3140 NEXT I
3150 VIEW PRINT 1 TO 24: CLS : BUF$ = "     FREQUENCY DISTRIBUTION GRAPHICAL OUTPUT     ": PRINT TAB((80 - LEN(BUF$)) / 2 + 1); : COLOR 0, 7: PRINT BUF$: COLOR 7, 0: VIEW PRINT 3 TO 24
3160  CLS : LOCATE 4: COLOR 0, 7: PRINT "AXIS DEFINITION": COLOR 7, 0
3170  LOCATE 7
3180 IF FLAGRAF = 2 THEN 3220
3190  PRINT "Current Minimum X: "; X0; : INPUT " - New: ", S$: IF S$ <> "" THEN X0 = VAL(S$)
3200  PRINT "Current Maximum X: "; X1; : INPUT " - New: ", S$: IF S$ <> "" THEN X1 = VAL(S$)
3210  PRINT
3220  PRINT "Current Minimum Y: "; Y0; : INPUT " - New: ", S$: IF S$ <> "" THEN Y0 = VAL(S$)
3230  PRINT "Current Maximum Y: "; Y1; : INPUT " - New: ", S$: IF S$ <> "" THEN Y1 = VAL(S$)
3240  PRINT : IF FLAGRAF = 2 THEN NX = NRFAX: NY = 5: GOTO 3260
3250  PRINT "Current Number of Ticks in the X-Axis: "; NX: INPUT "New: ", S$: IF S$ <> "" THEN NX = VAL(S$)
3260  PRINT "Current Number of Ticks in the Y-Axis: "; NY: INPUT "New: ", S$: IF S$ <> "" THEN NY = VAL(S$)
3270  PRINT : IF FLAGRAF = 2 THEN XA$ = "Frequency Classes": YA$ = "Percentage": GOTO 3320
3280  PRINT "Current X-Axis Label: "; XA$: LINE INPUT "New: ", S$: IF S$ <> "" THEN XA$ = S$
3290  PRINT "Current Y-Axis Label: "; YA$: LINE INPUT "New: ", S$: IF S$ <> "" THEN YA$ = S$
3300  PRINT : PRINT
3310  PRINT "Current Point Type: "; SM; : INPUT " - New: ", S$: IF S$ <> "" THEN SM = VAL(S$)
3320  VIEW PRINT 1 TO 24: CLS : BF$ = "GRAPHIC PLOTTING": PRINT TAB((80 - LEN(BF$)) / 2 + 1); : COLOR 0, 7: PRINT BF$: COLOR 7, 0: VIEW PRINT 4 TO 24
3330  LOCATE 7: PRINT "Press  to Plot Graphic.": PRINT : PRINT "After the BEEP the Graphic will be Ready;": PRINT
3340  PRINT "Press then: [P] to Print it;"
3345 PRINT TAB(15); "[R] to re-do it;": PRINT TAB(15); "[C] to Continue.": LOCATE 23: INPUT "Ready"; BUF$
3350 N = NEL
3360  GOSUB 3800
3370  GOSUB 3470
3380 IF FLAGRAF = 2 THEN 6440
3390  FOR I = 1 TO N
3400 X = I: Y = AM(I, REG + 1)
3410  GOSUB 3580
3420  IF PY < 0 OR PY > 199 THEN 3450
3430 IF PX < 51 OR PX > 639 THEN 3450
3440  IF SM = 1 THEN CIRCLE (PX, PY), 2.25 ELSE PSET (PX, PY), 0: DRAW LETRA$(SM + 26)
3450  NEXT
3460  GOTO 4360
3470  IF EX = 0 THEN 3500 ELSE IF EX > 0 THEN OFS = 1 ELSE OFS = 0
3480 EX$ = "(x10^" + RIGHT$(STR$(3 * EX), LEN(STR$(3 * EX)) - OFS) + ")"
3490 X$ = X$ + " " + EX$
3500  IF EY = 0 THEN 3530 ELSE IF EY > 0 THEN OFS = 1 ELSE OFS = 0
3510 EY$ = "(x10^" + RIGHT$(STR$(3 * EY), LEN(STR$(3 * EY)) - OFS) + ")"
3520 Y$ = Y$ + " " + EY$
3530 X = 51 + INT(529 - 10 * LEN(X$)) / 2: Y = 198
3540 P$ = X$: GOSUB 3730
3550 X = 51: Y = 8
3560 P$ = Y$: GOSUB 3730
3570  RETURN
3580 PX = 51 + 588 * (X - X0) / (X1 - X0)
3590 PY = 12 + 165 * (Y1 - Y) / (Y1 - Y0)
3600 IF FLAGINT = 1 THEN FLAGINT = 0: RETURN
3610 IF PX < 51 THEN PX = 51: IF PX > 639 THEN PX = 639
3620 IF PY < 12 THEN PY = 12 ELSE IF PY > 177 THEN PY = 177
3630  RETURN
3640 POV = 0
3650 SI = 1: IF VAR < 0 THEN SI = -1
3660 VAR = ABS(VAR): IF VAR = 0 THEN 3720
3670  IF VAR > 999 THEN VAR = VAR / 1000: POV = POV + 1: GOTO 3670
3680  IF VAR < 1 THEN VAR = VAR * 1000: POV = POV - 1: GOTO 3670
3690 VAR$ = STR$(SI * VAR)
3700 VAR$ = LEFT$(VAR$, FIXADOR)
3710 VAR = VAL(VAR$)
3720 RETURN
3730  FOR I = 1 TO LEN(P$)
3740 PA$ = MID$(P$, I, 1)
3750  IF PA$ = " " THEN 3780
3760 AP = ASC(PA$)
3770 PSET (X + (I - 1) * 10, Y), 0: DRAW LETRA$(AP)
3780  NEXT
3790  RETURN
3800 SCREEN 2
3810 X$ = XA$: Y$ = YA$: LINE (51, 12)-(639, 12): LINE (639, 12)-(639, 177): LINE (639, 177)-(51, 177): LINE (51, 177)-(51, 12)
3820 SX = (X1 - X0) / NX: SY = (Y1 - Y0) / NY
3830  FOR I = X0 TO X1 STEP SX
3840 X = I
3850  GOSUB 3580
3860  LINE (PX, 12)-(PX, 19): LINE (PX, 177)-(PX, 170)
3870  NEXT
3880  FOR I = Y0 TO Y1 STEP SY
3890 Y = I
3900  GOSUB 3580
3910  LINE (51, PY)-(67, PY): LINE (639, PY)-(622, PY)
3920  NEXT
3930 FIXADOR = 5
3940 VAR = X0: GOSUB 3640: PI = POV
3950 VAR = X1: GOSUB 3640: IF ABS(PI) < ABS(POV) THEN PI = POV
3960  FOR K = X0 TO X1 STEP SX
3970 X = K: FLAGINT = 1: GOSUB 3580
3980  IF PX < 51 OR PX >= 603 THEN 4060
3990 VAR = K + .00001
4000  GOSUB 3640
4010  IF POV <> PI THEN VAR = VAR * 10 ^ (3 * (POV - PI))
4020  IF ABS(VAR) < .0001 THEN VAR = 0
4030 P$ = LEFT$(STR$(VAR), 5): Y = 187
4040 X = PX - 6 * LEN(P$)
4050  GOSUB 3730
4060  NEXT
4070 EX = PI
4080 VAR = Y0: GOSUB 3640: PI = POV
4090 VAR = Y1: GOSUB 3640: IF ABS(PI) < ABS(POV) THEN PI = POV
4100  FOR K = Y0 TO Y1 STEP SY
4110 Y = K: FLAGINT = 1: GOSUB 3580
4120  IF PY < 20 OR PY > 177 THEN 4200
4130 Y = PY + 2
4140 VAR = K + .00001
4150  GOSUB 3640
4160  IF POV <> PI THEN VAR = VAR * 10 ^ (3 * (POV - PI))
4170  IF ABS(VAR) < .0001 THEN VAR = 0
4180 P$ = LEFT$(STR$(VAR), 5): X = 51 - 10 * LEN(P$)
4190  GOSUB 3730
4200  NEXT
4210 EY = PI
4220  RETURN
4230 IF FLAGRAF = 0 THEN Y = LIA: GOSUB 3580: X = 580: Y = PY - 3: P$ = "ILW": GOSUB 3730: L1 = PY: Y = LSA: GOSUB 3580: Y = PY - 3: P$ = "SLW": GOSUB 3730: L2 = PY: GOTO 4250
4240 Y = LIN: GOSUB 3580: X = 580: Y = PY - 3: P$ = "ILS": GOSUB 3730: L1 = PY: Y = LSN: GOSUB 3580: Y = PY - 3: P$ = "SLS": GOSUB 3730: L2 = PY
4250  FOR X = 58 TO 630 STEP 60
4260 LINE (X, L1)-(X + 30, L1): LINE (X, L2)-(X + 30, L2)
4270  NEXT
4280 IF FLAGRAF = 1 THEN 4330
4290 Y = LIC: GOSUB 3580: X = 580: Y = PY - 3: P$ = "ILC": GOSUB 3730: L1 = PY: Y = LSC: GOSUB 3580: Y = PY - 3: P$ = "SLC": GOSUB 3730: L2 = PY
4300  FOR X = 61 TO 639 STEP 15
4310  PSET (X, L1): PSET (X, L2)
4320  NEXT
4330 Y = MED1: GOSUB 3580: X = 580: Y = PY - 3: P$ = "MED": GOSUB 3730
4340  LINE (51, PY)-(639, PY)
4350  RETURN
4360 GOSUB 4230
4370 BEEP
4380 A$ = INKEY$: IF A$ <> "" THEN 4390 ELSE 4380
4390 IF A$ = "C" OR A$ = "c" OR A$ = "r" OR A$ = "R" THEN SCREEN 2: SCREEN 0: CLS : IF A$ = "C" OR A$ = "c" THEN 230 ELSE IF FLAGRAF = 2 THEN 3150 ELSE 3020
4400 IF A$ <> "P" AND A$ <> "p" THEN 4380
4410  OPEN "LPT1:" FOR RANDOM AS #1: WIDTH #1, 255: PRINT #1, CHR$(24); : PRINT #1, CHR$(27); "A"; CHR$(8); : DEF SEG = &HB800
4420 FOR A = 0 TO 79: PRINT #1, CHR$(27); "K"; CHR$(144); CHR$(1); : B = A + &H1EF0
4430 FOR C = 1 TO 100: D = PEEK(B): E = PEEK(B + &H2000): PRINT #1, CHR$(E); CHR$(E); CHR$(D); CHR$(D); : B = B - 80: NEXT
4440 PRINT #1, CHR$(13); CHR$(10); : NEXT
4450 PRINT #1, CHR$(13); CHR$(24); CHR$(27); CHR$(50); : CLOSE
4460 A$ = "C": GOTO 4390
4470 DIM LETRA$(125)
4480 FOR I = 28 TO 125: READ LETRA$(I): NEXT
4490 FOR I = 28 TO 125: LETRA$(I) = "P1,0" + LETRA$(I): NEXT
4500 RETURN
4510 DATA "BL2D1R4U2L4D1"
4520 DATA "L4R8L4U2D4"
4530 DATA "BD2L2R4H3G3R1"
4540 DATA "BU2L2R4G3H3R1"
4550 DATA ""
4560 DATA "BR3U1BU2U3"
4570 DATA "BR1BU5U1BR3D1"
4580 DATA "BR2U6BR3D6U4R2L7BD2R7"
4590 DATA "BR4U6D1R2L4G1F1R4F1G1L4"
4600 DATA "BR1BU6D1R1U1BD6BR4U1L1D1BL4E6"
4610 DATA "BR6H5E1R2F1G4F1R2E2"
4620 DATA "BR3BU6D2"
4630 DATA "BR4H2U2E2"
4640 DATA "BR1E2U2H2"
4650 DATA "BU3R6L3U2D4U2H2F4H2E2G4"
4660 DATA "BU3R6L3U2D4"
4670 DATA "BR2E1U1L1"
4680 DATA "BU3R5"
4690 DATA "BR2U1R1D1"
4700 DATA "E6"
4710 DATA "R3E1U4H1L3G1D4E4"
4720 DATA "BR1R4L2U6G1"
4730 DATA "R5L5E5H1L3G1"
4740 DATA "BU1F1R3E1U1H2E2L5"
4750 DATA "BR4U6G4R5"
4760 DATA "BU1F1R3E1U2H1L4U2R5"
4770 DATA "BR1R3E1U1BD1G1L3BL1BU1U1BE1R3BL3BL1BE1E2"
4780 DATA "BR2U2E4L6"
4790 DATA "BR1R3E1U1H1L3BG1D1U1E1H1U1E1R3F1D1"
4800 DATA "BR1E4BU1H1L3G1D1F1R2BR1"
4810 DATA "BR2BU1U1R1D1L1BU3U1R1D1"
4820 DATA "BR2E1U1L1BU2U1R1D1"
4830 DATA "BU3F3H3E3"
4840 DATA "BU2R5BU2L5"
4850 DATA "BR5BU3H3F3G3"
4860 DATA "BR3U1BU2E2H1L3G1"
4870 DATA "BU1U1E1R1D3L1R3E1U4H1L3G1"
4880 DATA "U5BU1BR1R3BR1BD1D5BL5BU3R5"
4890 DATA "U6R4BR1BD1D1BD1D2BD1BL1L4U3R4"
4900 DATA "BU1U4BU1BR1R3F1BD4G1L3"
4910 DATA "U6R3F1F1D2G1G1L3"
4920 DATA "U6R5BD3BL4R3BD3BL4R5"
4930 DATA "U6R5BD3BL4R3"
4940 DATA "BU1U4BU1BR1R3F1BD2L2BR2D3L4"
4950 DATA "U6D3R5U3D6"
4960 DATA "BR2R2L1U6L1R2"
4970 DATA "BU1U1BF2L1R3BR1BU1U5BL1R2"
4980 DATA "U6D3R2E3G3F3"
4990 DATA "U6D6R5"
5000 DATA "U6F3D1U1E3D6"
5010 DATA "U6BD1R1BD1R1BD1R1BD1R1BD1R1BD1R1U6"
5020 DATA "BU1U4E1R3F1D4G1L3"
5030 DATA "U6R4F1D1G1L3"
5040 DATA "BU1U4BE1R3BF1D2G3L1BR2BU3F3"
5050 DATA "U6R4BF1D1BG1L3R1F3"
5060 DATA "BU1F1R3E1U1H1L3H1U1E1R3F1"
5070 DATA "BR2U6L3R6"
5080 DATA "BU1U5D5F1R3E1U5"
5090 DATA "BU3U3D3F3E3U3"
5100 DATA "U6D6E3U1D1F3U6"
5110 DATA "E6G3H3F6"
5120 DATA "BR3U3H3F3E3"
5130 DATA "R5L5E5U1L5"
5140 DATA "BR1R2L2U6R2"
5150 DATA "BU6F6"
5160 DATA "BR2R2U6L2"
5170 DATA "BR3U6F3H3G3"
5180 DATA "R6"
5190 DATA "BU6BR3D1G1"
5200 DATA "BR1H1E1R4D2L4R4U3H1L3"
5210 DATA "BR1R3E1U2H1L2G2D1U5"
5220 DATA "BR1R3E1G1L3H1U2E1R3"
5230 DATA "BR1R4U6D4H2L2G1D2"
5240 DATA "BR1R3L3H1U2E1R3F1D1L5"
5250 DATA "BR2U3L1R2L1U2E1R1F1"
5260 DATA "BR1R3E1U3L4G1F1R4"
5270 DATA "U6D4E2R2F1D3"
5280 DATA "BR1R2L1U4BU2L1BR1BD2L1"
5290 DATA "BU1F1R2E1U3BU2L1"
5300 DATA "BR1U6D4R2E2G2F2"
5310 DATA "BR2R2L1U6L1"
5320 DATA "U4R1R1F1D3U3E1R1F1D3"
5330 DATA "U4D2E2R2F1D3"
5340 DATA "BR1R3E1U2H1L3G1D2"
5350 DATA "U4R5F1G1L5"
5360 DATA "BR5U4L5G1F1R5"
5370 DATA "BR1U4D2E2R2"
5380 DATA "R4E1H1L3H1E1R4"
5390 DATA "BR2R1E1G1BL1BU1U4D1L1R2"
5400 DATA "BU1U3D3F1R2E3U1D4"
5410 DATA "BU3U1D1F3E3U1"
5420 DATA "BU1U3D3F1R1E1U1D1F1R1E1U3"
5430 DATA "E2R1E2G2L1H2F2R1F2"
5440 DATA "R2E3U1D1G1L2H2"
5450 DATA "R5L5BU1R1BR1BU1R1BU1BR1R1BU1L5"
5460 DATA "BR3R1L1H1U1H1L1R1E1U1E1R1"
5470 DATA "BR3U2BU2U2"
5480 DATA "BR2R1E1U1E1R1L1H1U1H1L1"
5490 DATA  24
5500  DATA  0, 0, 0, 0, 0, 0
5510  DATA  2, 3.76, 1.88, 0, 3.267, 1.128
5520  DATA  3, 2.394, 1.023, 0, 2.575, 1.693
5530  DATA  4, 1.88, .729, 0, 2.282, 2.059
5540  DATA  5, 1.596, .577, 0, 2.115, 2.326
5550  DATA  6, 1.41, .483, 0, 2.004, 2.534
5560  DATA  7, 1.277, .419, .076, 1.924, 2.704
5570  DATA  8, 1.175, .373, .136, 1.864, 2.847
5580  DATA  9, 1.094, .337, .184, 1.816, 2.97
5590  DATA  10, 1.028, .308, .223, 1.777, 3.078
5600  DATA  11, .973, .285, .256, 1.744, 3.173
5610  DATA  12, .925, .266, .284, 1.716, 3.258
5620  DATA  13, .884, .249, .308, 1.692, 3.336
5630  DATA  14, .848, .235, .329, 1.671, 3.407
5640  DATA  15, .816, .223, .348, 1.652, 3.472
5650  DATA  16, .788, .212, .364, 1.636, 3.532
5660  DATA  17, .762, .203, .379, 1.621, 3.588
5670  DATA  18, .738, .194, .392, 1.608, 3.64
5680  DATA  19, .717, .187, .404, 1.596, 3.689
5690  DATA  20, .697, .18, .414, 1.586, 3.735
5700  DATA  21, .679, .173, .425, 1.575, 3.778
5710  DATA  22, .662, .167, .434, 1.566, 3.819
5720  DATA  23, .647, .162, .443, 1.557, 3.858
5730  DATA  24, .632, .157, .452, 1.548, 3.895
5740  DATA  25, .619, .153, .459, 1.541, 3.931
5750 REM ===> CALCULO DA DISTRIBUICAO DE FREQUENCIAS.  = NUMERO DE FAIXAS;  = FAIXAS DELIMITADAS ENTRE  E , ABAIXO DE  E ACIMA DE ;  = INTERVALOS DE FAIXAS DE FREQUENCIA.
5760 REM ===> A ULTIMA FAIXA INICIA-SE EM  E VAI ATE' , POIS A FAIXA SE INICIA EM  -  IGUAL OU MAIOR - E VAI ATE' , EXCLUSIVE.
5770 CLS : BUF$ = "     FREQUENCY DISTRIBUTION CALCULATION     ": PRINT TAB((80 - LEN(BUF$)) / 2 + 1); : COLOR 0, 7: PRINT BUF$: COLOR 7, 0: VIEW PRINT 3 TO 24
5780 IF FLAGCALC <> 0 THEN 5810
5790 BEEP: LOCATE 9: PRINT "Data "; : COLOR 31, 0: PRINT "were not"; : COLOR 7, 0: PRINT " Statistically Processed Yet!": LOCATE 15: PRINT "Please Generate the S.P.C. Chart before Calculating the Frequency Distribution."
5800 LOCATE 22: INPUT "Press  to Continue...", BUF$: GOTO 230
5810 IF NEL * NEG >= 100 THEN 5840
5820 BEEP: LOCATE 9: PRINT "Matrix "; : COLOR 31, 0: PRINT "Too Little"; : COLOR 7, 0: PRINT " for the Determination of Frequency Distribution!"
5830 LOCATE 16: INPUT "Press  to Continue...", BUF$: GOTO 230
5840 PRINT : PRINT : PRINT "Inferior Limit of Standard = "; : PRINT USING "####.#"; LIN; : PRINT TAB(40); "Superior Limit of Standard = "; : PRINT USING "####.#"; LSN: PRINT : PRINT
5850 INPUT "Inferior Limit of Histogram"; LIH: PRINT : INPUT "Superior Limit of Histogram"; LSH: PRINT : INPUT "Frequency Interval"; INTFR
5860 CLS : LOCATE 9: PRINT "Cogito, Ergo Sum!": LOCATE 15: PRINT "This Can Take Some Time..."
5870 NRFAX = INT((LSH - LIH) / INTFR)
5880 FOR I = 0 TO NRFAX + 2: FAX(I) = 0: NEXT I
5890 FOR JI = 1 TO NEL
5900 IF AM(JI, NEG + 1) < LIH THEN FAX(0) = FAX(0) + 1: GOTO 5930
5910 IF AM(JI, NEG + 1) = LSH THEN FAX(NRFAX + 1) = FAX(NRFAX + 1) + 1: GOTO 5930
5920 IF AM(JI, NEG + 1) > LSH THEN FAX(NRFAX + 2) = FAX(NRFAX + 1) + 1: GOTO 5930
5930 NEXT JI
5940 FOR JI = 1 TO NEL
5950 FOR I = 1 TO NRFAX
5960 IF AM(JI, NEG + 1) >= LIH + INTFR * (I - 1) AND AM(JI, NEG + 1) < LIH + INTFR * (I) THEN FAX(I) = FAX(I) + 1: GOTO 5970
5970 NEXT I: NEXT JI: FLAGCALC = 2
5980 CLS : PRINT : PRINT : PRINT "Inferior Limit of Standard = "; : PRINT USING "####.#"; LIN; : PRINT TAB(40); "Superior Limit of Standard = "; : PRINT USING "####.#"; LSN: PRINT
5990 FOR I = 1 TO NRFAX + 1: PRINT "Class ("; : BUF$ = STR$(LIH + INTFR * (I - 1))
6000 IF LIH + INTFR * (I - 1) < 0 THEN CSTR = 1 ELSE CSTR = 2
6010 PRINT MID$(BUF$, CSTR, LEN(BUF$) - 1); ") "; TAB(20); " No. Samples = "; : PRINT USING "###"; FAX(I); : PRINT TAB(40); : PRINT USING "###.##"; FAX(I) / NEL * 100; : PRINT "%": NEXT I
6020 PRINT : PRINT : COLOR 0, 7: PRINT "Data Out of the Specified Limits:"; : COLOR 7, 0: PRINT : PRINT
6030 PRINT "Classes ("; : BUF$ = STR$(LIH + INTFR * (-1))
6040 IF LIH + INTFR * (-1) < 0 THEN CSTR = 1 ELSE CSTR = 2
6050 PRINT MID$(BUF$, CSTR, LEN(BUF$) - 1); ") "; TAB(20); " No. Samples = "; : PRINT USING "###"; FAX(0); : PRINT TAB(40); : PRINT USING "###.##"; FAX(0) / NEL * 100; : PRINT "%"
6060 PRINT "Class ("; : BUF$ = STR$(LIH + INTFR * (NRFAX + 1))
6070 IF LIH + INTFR * (NRFAX + 1) < 0 THEN CSTR = 1 ELSE CSTR = 2
6080 PRINT MID$(BUF$, CSTR, LEN(BUF$) - 1); ") "; TAB(20); " Nr.Dados = "; : PRINT USING "###"; FAX(NRFAX + 2); : PRINT TAB(40); : PRINT USING "###.##"; FAX(NRFAX + 2) / NEL * 100; : PRINT "%"
6090 TOTPCT = 0
6100 FOR I = 0 TO NRFAX + 1: TOTPCT = TOTPCT + INT(FAX(I) / NEL * 10000) / 100: NEXT I
6110 PRINT "   Total  = "; TAB(32); NEL; TAB(40); : PRINT USING "###.##"; TOTPCT; : PRINT "%"
6120 PRINT : INPUT "Press  to Continue...", BUF$
6130 GOTO 230
6140 REM ===> IMPRESSAO DA DISTRIBUICAO DE FREQUENCIAS.
6150 CLS : BUF$ = "    FREQUENCY DISTRIBUTION PRINTINGTRIBUICAO DE FREQUENCIAS     ": PRINT TAB((80 - LEN(BUF$)) / 2 + 1); : COLOR 0, 7: PRINT BUF$: COLOR 7, 0: VIEW PRINT 3 TO 24
6160 IF FLAGCALC = 2 THEN 6190
6170 CLS : BEEP: LOCATE 9: PRINT "Frequency Distribution "; : COLOR 31, 0: PRINT "was not"; : COLOR 7, 0: PRINT " Calculated Yet!": LOCATE 15: PRINT "Generate it before Printing."
6180 LOCATE 22: INPUT "Press  to Continue...", BUF$: GOTO 230
6190 LOCATE 9: PRINT "Cogito, Ergo Sum!": LOCATE 15: PRINT "This can Take Some Time..."
6200 NRFAX = INT((LSH - LIH) / INTFR)
6210 FOR I = 1 TO NRFAX + 2: FAX(I) = 0: NEXT I
6220 FOR JI = 1 TO NEL
6230 FOR I = 1 TO NRFAX + 2
6240 IF AM(JI, NEG + 1) >= LIH + INTFR * (I - 1) AND AM(JI, NEG + 1) < LIH + INTFR * (I) THEN FAX(I) = FAX(I) + 1: GOTO 6250
6250 NEXT I: NEXT JI
6260 CLS : LOCATE 9: PRINT "Identification Message to be Printed in the Report?": INPUT "", BUF$: LOCATE 15: INPUT "Prepare Printer and Press !", ESCC$
6270 LPRINT CHR$(14); "FREQUENCY DISTRIBUTION": LPRINT : LPRINT BUF$: LPRINT
6280 IF NARQ$ = "" THEN LPRINT "Data Entered via Keyboard" ELSE IF FLAGSAVE = 0 THEN LPRINT "Data from the File "; NARQ$ ELSE LPRINT "Data from the Keyboard and from the File "; NARQ$
6290 GOSUB 6550
6300 LPRINT : LPRINT
6310 LPRINT TAB(8); "Class"; TAB(24); "Nr. Dados"; TAB(36); "Percentage"
6320 FOR I = 1 TO NRFAX + 1: LPRINT "      ("; : BUF$ = STR$(LIH + INTFR * (I - 1))
6330 IF LIH + INTFR * (I - 1) < 0 THEN CSTR = 1 ELSE CSTR = 2
6340 LPRINT MID$(BUF$, CSTR, LEN(BUF$) - 1); : LPRINT ")"; TAB(23); : LPRINT USING "####"; FAX(I); : LPRINT TAB(35); : LPRINT USING "###.##"; FAX(I) / NEL * 100: NEXT I
6350 TOTPCT = 0: FOR I = 1 TO NRFAX + 1: TOTPCT = TOTPCT + FAX(I) / NEL * 100: NEXT I
6360 LPRINT : LPRINT : LPRINT "Data Out of the Specified Limits:": LPRINT
6370 LPRINT TAB(8); "Class"; TAB(24); "Nr. Dados"; TAB(36); "Percentage"
6380 BUF$ = STR$(LIH + INTFR * (-1)): IF LIH + INTFR * (-1) < 0 THEN CSTR = 1 ELSE CSTR = 2
6390 LPRINT TAB(7); "("; MID$(BUF$, CSTR, LEN(BUF$) - 1); : LPRINT ")"; TAB(23); : LPRINT USING "####"; FAX(0); : LPRINT TAB(35); : LPRINT USING "###.##"; FAX(0) / NEL * 100
6400 BUF$ = STR$(LIH + INTFR * (NRFAX + 1)): IF LIH + INTFR * (NRFAX + 1) < 0 THEN CSTR = 1 ELSE CSTR = 2
6410 LPRINT TAB(7); "("; MID$(BUF$, CSTR, LEN(BUF$) + 1); ") "; TAB(23); : LPRINT USING "###"; FAX(NRFAX + 2); : LPRINT TAB(35); : LPRINT USING "###.##"; FAX(NRFAX + 2) / NEL * 100
6420 LPRINT : LPRINT "   Total  = "; TAB(23); : LPRINT USING "####"; NEL; : LPRINT TAB(35); : LPRINT USING "###.##"; TOTPCT
6430 LPRINT CHR$(12): CLS : GOTO 2470
6440 REM ===> FIM DA IMPRESSAO.
6450 FOR I = 1 TO NRFAX + 1
6460 IF FAX(I) = 0 THEN 6480
6470 X = LIH + INTFR * (I - 1): Y = FAX(I) / NEL * 100: GOSUB 3580: LINE (PX, 177)-(PX, PY): AUX = PX: X = LIH + INTFR * I: GOSUB 3580: LINE (AUX, PY)-(PX, PY): LINE (PX, PY)-(PX, 177)
6480 NEXT I
6490 X = LIN: GOSUB 3580: L1 = PX: X = LSN: GOSUB 3580: L2 = PX: IF L1 < 51 OR L1 > 639 OR L2 < 51 OR L2 > 639 THEN 4370
6500 FOR Y = 12 TO 177 STEP 5: PSET (L1, Y): PSET (L2, Y): NEXT Y
6510 X = LIN: GOSUB 3580: X = PX + 10: Y = 25: P$ = "LIN": GOSUB 3730
6520 X = LSN: GOSUB 3580: X = PX - 35: Y = 25: P$ = "LSN": GOSUB 3730
6530 GOTO 4370
6540 FOR I = 1 TO NEG: PRINT TAB(7 * (I - 1) + 1); "X("; : BUF$ = STR$(I): PRINT MID$(BUF$, 2, LEN(BUF$) - 1); ")"; : NEXT I: PRINT TAB(7 * (NEG) + 2); "Med"; TAB(7 * (NEG + 1) + 3); "R": RETURN
6550 DIA$ = MID$(DATE$, 4, 2) + "/" + MID$(DATE$, 1, 2) + "/" + RIGHT$(DATE$, 4): LPRINT DIA$; ", "; TIME$: LPRINT : LPRINT : RETURN
6560 FOR I = 1 TO NEG: LPRINT TAB(7 * (I - 1) + 1); "X("; : BUF1$ = STR$(I): LPRINT MID$(BUF1$, 2, LEN(BUF1$) - 1); ")"; : NEXT I: LPRINT TAB(7 * (NEG) + 1); "  Med"; TAB(7 * (NEG + 1) - 1); "    R": RETURN
6570 CLOSE : SCREEN 2: SCREEN 0: VIEW PRINT 1 TO 24: CLS : BEEP: BUF$ = "     INTERRUPCAO NO PROGRAMA     ": PRINT TAB((80 - LEN(BUF$)) / 2 + 1); : COLOR 0, 7: PRINT BUF$: COLOR 7, 0
6580 LOCATE 12: PRINT "Error"; : COLOR 31, 0: PRINT ERR; : COLOR 7, 0: PRINT "at Line "; : PRINT USING "#####"; ERL; : PRINT "!"
6590 LOCATE 22: INPUT "Press  to Continue...", BUF$: RESUME 230

***** End of Program Listing ******


Return to the Software Menu.

Last Update: 28 June 1996
© Antonio Augusto Gorni