1 REM                TIME CLOCK PROGRAM  
2 REM                          BY DR. PETER SHENKIN  
5 CLS  
10 PRINT "               TIME CLOCK"  
20 PRINT   
30 PRINT "THIS PROGRAM USES AS INPUT THE USUAL INFORMATION ON THE  
40 PRINT "COMINGS AND GOINGS OF EMPLOYES STAMPED BY A TIME CLOCK ON  
50 PRINT "THE EMPLOYEE TIME CARD. aS OUTPUT THE COMPUTER GIVES A  
60 PRINT "SUMMARY OF THE NUMBER OF HOURS THE EMPLOYEE HAS WORKED  
70 PRINT "EACH DAY ALONG WITH THE TOTAL OF HOURS FOR THE WEEK. THE  
80 PRINT "WEEKLY HOURS ARE DIVIDED INTO REGULAR AND OVERTIME HOURS  
90 PRINT "WITH OVERTIME HOURS CONSIDERED TO BE THOSE HOURS GREATER  
100 PRINT "THAN 40. THERE IS THE OPTION TO MANUALLY OVERRIDE THE DIVISION  
110 PRINT "OF REGULAR VERSUS OVERTIME HOURS.";  
120 PRINT :INPUT "PRESS ENTER TO CONTINUE";Z9$  
1000 GOTO  40000  
10000 REM INPUT ERROR SUBROUTINE  
10010 PRINT "INPUT ERROR! TRY AGAIN!"  
10030 RETURN   
40000 REM TIME CLOCK  
40001 DEFINT  X,J  
40002 DIM  AI$(30),AI(30),AO$(30),AO(30),TP(30)  
40005 CLS  
40006 INPUT "INPUT Y IF PRINTER DESIRED,N IF NOT";Z2$  
40007 IF  Z2$<>"Y"  AND  Z2$<>"N" THEN GOSUB  10000:GOTO  40006  
40010 DATA  MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY,SUNDAY  
40020 FOR  J8=1  TO  7:READ  X$(J8):NEXT   
40025 CLS:REM BEGIN FOR AN EMPLOYEE  
40027 INPUT"EMPLOYEE NUMBER ";CN:REM LINK TO COMPUTE  
40028 IF CN = -1 THEN  END
40030 J1=1:REM DAY OF WEEK WE ARE ON   
40035 X=1:XD=1:REM X= ENTRY: XD= DAY  
40040 PRINT "ENTER TIME FOR DAY OF WEEK GIVEN. FORM SHOULD BE:  
40045 PRINT "A OR P,HR IN.MIN IN,A OR P,HR OUT. MIN OUT  
40050 PRINT "TO END DAY ENTER D,0,0,0.TO END WEEK ENTER W,0,0,0  
40055 PRINT  X$(XD)  
40060 INPUT "A OR P,TIME IN,A OR P,TIME OUT"; AI$(X),AI(X),AO$(X),AO(X)  
40063 IF  AI$(X)<>"A"  AND AI$(X)<>"P"  AND AI$(X)<>"D"  AND AI$(X)<>"W" THEN GOSUB 10000:GOTO 40060  
40066 IF  AO$(X)<>"A"  AND  AO$(X)<>"P"  AND  AO$(X)<>"0"  AND  AO$(X)<>"" THEN GOSUB 10000:GOTO  40060  
40070 IF  AI$(X) <> "D"  AND  AI$(X) <> "W"  THEN  X=X+1: GOTO  40060  
40080 IF  AI$(X)="D" THEN XD=XD+1:X=X+1:GOTO  40055  
40090 IF  AI$(X)="W" THEN GOTO  40100  
40100 REM WEEK FINISHED. START COMPUTING  
40105 FOR  J8=1  TO  7:TQ(J8)=0:NEXT   
40110 REM Tq(I) = TOTAL DAY I  
40115 FOR  X1=1  TO  X:TP(X1)=0:NEXT  X1  
40120 REM TP(I) = TOTAL FOR ENTRY I  
40130 D8=1:REM D8= DAY  
40140 FOR  X1=1  TO  X  
40145 IF  AI$(X1)="D"  THEN  D8=D8+1:GOTO  40200  
40150 SI=60*INT(AI(X1))+100*(AI(X1)-INT(AI(X1)))  
40160 SO=60*INT(AO(X1))+100*(AO(X1)-INT(AO(X1)))  
40170 IF  AI$(X1)="A"  AND  AO$(X1)="P"  AND  AO(X1)<12  THEN  SO=SO +     720  
40175 IF  AI(X1)>=12  AND  AO(X1)<12  THEN  SO=SO+720:GOTO  40185  
40180 IF  AI$(X1)="P"  AND  AO$(X1)="A"  THEN  SO=SO+720  
40185 TP(X1)=(SO-SI)/60:TQ(D8)=TQ(D8)+(SO-SI)/60:REM COMPUTE       TIME TP & SUM  TIME FOR DAY  
40200 NEXT  X1  
40205 REM TT= TOTAL TIME FOR WEEK  
40210 TT=0:TR=0:T0=0:FOR  J8=1  TO  D8:TT=TT+TQ(J8):NEXT   
40220 REM OVERTIME  
40230 IF  TT>40  THEN  TR=40:T0=TT-40:GOTO  40250  
40240 TR=TT  
40250 TT=INT(100*TT+.5)/100:TR=INT(100*TR+.5)/100:T0=INT(100*T0+.5)/100  
40300 REM PRINTOUT FOR EMPLOYEE  
40302 CLS  
40305 XD=1  
40310 FOR  X1=1  TO  X  
40320 IF  AI$(X1)="D"  OR  AI$(X1)="W"  THEN  PRINT  X$(XD);TAB(15);"TOTAL = ";TAB(30);  TQ(XD);TAB(40);"HRS.":XD=XD+1:GOTO  40350  
40330 PRINT  AI$(X1);" ";AI(X1);TAB(20); AO$(X1);TAB(27);AO(X1);TAB(40); "TOTAL = ";TP(X1);TAB(60); "HRS"  
40350 NEXT  X1  
40360 PRINT  TAB(30); "GRAND TOTAL = ";INT(100*TT+.5)/100  
40370 PRINT  "REGULAR HOURS  = ";TR,"OVERTIME HOURS = ";T0  
40380 Z4=TR:Z5=T0  
40390 INPUT "REGULAR HOURS,OVERTIME HOURS ";TR,T0  
40395 TT=TR+T0  
40400 IF  Z2$="N" THEN GOTO  40025  
40402 REM PRINT TIME ON PRINTER  
40405 XD=1  
40407 LPRINT  "EMPLOYEE NUMBER ";CN:LPRINT   
40410 FOR  X1=1  TO  X  
40420 IF  AI$(X1)="D"  OR  AI$(X1)="W"  THEN  LPRINT  X$(XD);TAB(15);"TOTAL = ";TAB(30); TQ(XD);TAB(40);"HRS":XD=XD+1:GOTO  40450  
40430 LPRINT  AI$(X1);" ";AI(X1);TAB(20); AO$(X1);TAB(27);AO(X1);TAB(40); "TOTAL = ";TP(X1);TAB(60); "HRS"  
40450 NEXT  X1  
40460 LPRINT  TAB(30); "GRAND TOTAL = ";INT(100*TT+.5)/100  
40470 LPRINT  "REGULAR HOURS = ";TR,"OVERTIME HOURS = ";T0  
40480 FOR  X1=1  TO  10:LPRINT " ":NEXT   
40500 GOTO  40025  

