1 " "WAIT 90:CLEAR :USING :DIM ME$(0)*26:LOCK :ON ERROR GOTO 800
2 CLS :CURSOR 5:PRINT "DAYS AND DATES"
3 PRINT "  Copr. 1982 Tandy Corp."
10 RESTORE 20:WAIT 0:FOR I=1TO 5:CLS :READ ME$(0):PRINT ME$(0):FOR J=1TO 75:A$=INKEY$ :IF A$<>""LET J=75
11 NEXT J
12 J=0:FOR K=1TO 4:IF MID$ ("ABCX",K,1)=A$LET J=K:K=4
13 NEXT K:IF J>0LET I=5:NEXT I:WAIT :GOTO A$
14 NEXT I:GOTO 10
20 DATA "Select Function:"
21 DATA "Find day of week: A"
22 DATA "Days between dates: B"
23 DATA "Date days hence/ago: C"
24 DATA "Exit program: X"
100 "A"WAIT 0:PRINT "Enter";:GOSUB "GD":GOSUB "GTJ":CLS :GOSUB "DOW":GOTO 10
200 "B"WAIT 0:PRINT "First";:GOSUB "GD":GOSUB "GTJ":A=J:CLS :WAIT 0:PRINT "Second";:GOSUB "GD":GOSUB "GTJ"
210 CLS :PRINT ABS (A-J);" days between dates":GOTO 10
300 "C"WAIT 0:CLS :PRINT "Ref";:GOSUB "GD":GOSUB "GTJ":A=J
310 CLS :INPUT "Days hence (+)/ago (-)? ";B
320 J=A+B:GOSUB "JTG":WAIT 0:PRINT STR$ M;"/";STR$ D;"/";STR$ Y;"  ";:GOSUB "DOW":GOTO 10
400 "GD"INPUT " date? (MM/DD/YYYY)";D$
405 IF LEN D$<8OR LEN D$>10THEN 425
410 M=VAL LEFT$ (D$,2):E=2:GOSUB "FS":D=VAL MID$ (D$,E+1,2):Y=VAL RIGHT$ (D$,4)
412 IF D<1OR M<1OR M>12OR Y<1900OR Y>2100THEN 425
414 IF (M=4OR M=6OR M=9OR M=11)AND D>30THEN 425
416 IF M<>2AND D>31THEN 425
418 IF M=2AND D>(28+(INT (Y/4)=(Y/4)))THEN 425
420 IF (Y=1900AND M<3)OR (Y=2100AND M>2)THEN 425
422 WAIT :RETURN 
425 BEEP 3:CLS :GOTO 400
450 "FS"IF MID$ (D$,E,1)<>"/"LET E=E+1:GOTO "FS"
460 RETURN 
500 "GTJ":IF M<3LET M=M+12:Y=Y-1
510 M=M+1:J=INT (365.25*Y)+INT (30.6001*M)+D+1720982:RETURN 
600 "JTG"R=J+68569:P=INT (4*R/146097):R=-INT ((146097*P+3)/4)+R
610 Y=INT (4000*(R+1)/1461001):R=-INT (1461*Y/4)+31+R:M=INT (80*R/2447)
620 D=-INT (2447*M/80)+R:R=INT (M/11):M=-12*R+2+M:Y=100*(P-49)+Y+R:RETURN 
700 "DOW"WAIT :E=J+1-7*INT ((J+1)/7):RESTORE 710+E:READ DW$:PRINT DW$:RETURN 
710 DATA "Sunday"
711 DATA "Monday"
712 DATA "Tuesday"
713 DATA "Wednesday"
714 DATA "Thursday"
715 DATA "Friday"
716 DATA "Saturday"
800 PRINT "*** ERROR";PEEK &789B;" in";STATUS 4;" ***":GOTO 10
900 "X"UNLOCK :END
