10 PRINT TAB(32);"WEEKDAY"
20 PRINT TAB(15);"CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
30 PRINT:PRINT:PRINT
35 REM TABLE OF VALUES FOR THE MONTHS TO BE USED IN CALCULATIONS
40 PUSH 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5
50 FOR I=12 TO 1 STEP -1
60 @(I)=POP()
70 NEXT I
100 PRINT "WEEKDAY IS A COMPUTER DEMONSTRATION THAT"
110 PRINT "GIVES FACTS ABOUT A DATE OF INTEREST TO YOU."
120 PRINT
130 PRINT "ENTER TODAY'S DATE"
140 INPUT "YEAR:  ";E: INPUT "MONTH: ";I: INPUT "DAY:   ";J
150 REM THIS PROGRAM DETERMINES THE DAY OF THE WEEK
160 REM  FOR A DATE AFTER 1582
200 REM SPACE OUTPUT AND READ IN INITIAL VALUES FOR MONTHS.
240 PRINT:PRINT "ENTER DAY OF BIRTH (OR OTHER DAY OF INTEREST)"
250 INPUT "YEAR:  ";Y : INPUT "MONTH: ";M : INPUT "DAY:   ";D
260 PRINT
270 LET Q = ((Y-1500)/100)
280 REM TEST FOR DATE BEFORE CURRENT CALENDAR.
290 IF Y-1582 <0 THEN 1300
300 LET A = Q*5+(Q+3)/4
310 LET R=(A-(A/7)*7)
320 LET G=(Y/100)
330 LET H =(Y-G*100)
340 LET A=H/4+H+D+@(M)+R
350 LET B=(A-(A/7)*7)+1
360 IF M > 2 THEN 470
370 IF H = 0 THEN 440
380 LET T=(Y-(Y/4)*4)
390 IF T#0 THEN 470
400 IF B#0 THEN 420
410 LET B=6
420 LET B=B-1
430 GOTO 470
440 LET A = Q-1
450 LET T=(A-(A/4)*4)
460 IF T = 0 THEN 400
470 IF B#0 THEN 490
480 LET B=7
490 IF (E*12+I)*31+J<(Y*12+M)*31+D THEN 550
500 IF (E*12+I)*31+J=(Y*12+M)*31+D THEN 530
510 PRINT Y;"/";M;"/";D;" WAS A ";
520 GOTO 570
530 PRINT Y;"/";M;"/";D;" IS A ";
540 GOTO 570
550 PRINT Y;"/";M;"/";D;" WILL BE A ";
560 REM PRINT THE DAY OF THE WEEK THE DATE FALLS ON.
570 IF B#1 THEN 590
580 PRINT "SUNDAY."
590 IF B#2 THEN 610
600 PRINT "MONDAY."
610 IF B#3 THEN 630
620 PRINT "TUESDAY."
630 IF B#4 THEN 650
640 PRINT "WEDNESDAY."
650 IF B#5 THEN 670
660 PRINT "THURSDAY."
670 IF B#6 THEN 690
680 GOTO 1250
690 IF B#7 THEN 710
700 PRINT "SATURDAY."
710 IF (E*12+I)*31+J=(Y*12+M)*31+D THEN 1120
720 LET S=E-Y
730 PRINT
740 LET U=I-M
750 LET V=J-D
760 IF V>-1 THEN 790
770 LET U= U-1
780 LET V=V+30
790 IF U>-1 THEN 820
800 LET S=S-1
810 LET U=U+12
820 IF S<0 THEN 1310
830 IF V # 0 THEN 850
835 IF U # 0 THEN 850
840 PRINT "***HAPPY BIRTHDAY***"
850 PRINT "","","","","YEARS","MONTHS","DAYS"
855 PRINT "","","","","-----","------","----"
860 PRINT "YOUR AGE (IF BIRTHDATE) ",S,U,V
870 LET C = (S*365)+(U*30)+V+U/2)
880 LET L = S
890 LET N = U
900 LET P = V
910 REM CALCULATE RETIREMENT DATE.
920 LET E = Y+65
930 REM CALCULATE TIME SPENT IN THE FOLLOWING FUNCTIONS.
940 LET F = 35
950 PRINT "YOU HAVE SLEPT","","",
960 GOSUB 1370
970 LET F = 17
980 PRINT "YOU HAVE EATEN","","",
990 GOSUB 1370
1000 LET F = 23
1010 IF L > 3 THEN 1040
1020 PRINT "YOU HAVE PLAYED","",
1030 GOTO 1080
1040 IF L > 9 THEN 1070
1050 PRINT "YOU HAVE PLAYED/STUDIED","",
1060 GOTO  1080
1070 PRINT "YOU HAVE WORKED/PLAYED","",
1080 GOSUB 1370
1085 GOTO 1530
1090 PRINT "YOU HAVE RELAXED","",L,N,P
1100 PRINT 
1110 PRINT TAB(16);"*** YOU MAY RETIRE IN ";E;" ***"
1120 PRINT
1140 PRINT
1200 PRINT
1210 PRINT
1220 PRINT
1230 PRINT
1240 END
1250 IF D=13 THEN 1280
1260 PRINT "FRIDAY."
1270 GOTO 710
1280 PRINT "FRIDAY THE THIRTEENTH---BEWARE!"
1290 GOTO 710
1300 PRINT "NOT PREPARED TO GIVE DAY OF WEEK PRIOR TO MDLXXXII. "
1310 GOTO 1140
1340 REM THIS IS THE CURRENT DATE USED IN THE CALCULATIONS.
1350 REM THIS IS THE DATE TO BE CALCULATED ON.
1360 REM CALCULATE TIME IN YEARS, MONTHS, AND DAYS
1370 LET K=(F*C)/100
1380 LET S = (K/365)
1390 LET K = K-(S*365)
1400 LET U = (K/30)
1410 LET V = K -(U*30)
1420 LET L = L-S
1430 LET N =N-U
1440 LET P = P-V
1450 IF P>-1 THEN 1480
1460 LET P=P+30
1470 LET N=N-1
1480 IF N>0 THEN 1510
1490 LET N=N+12
1500 LET L=L-1
1510 PRINT S,U,V
1520 RETURN
1530 IF N=12 THEN 1550
1540 GOTO 1090
1550 LET L=L+1
1560 LET N=0
1570 GOTO 1090
1580 REM
1590 END
