10 REM ***** PROGRAM 'DATES' ****************
20 REM ***** SUBMITTED BY HERMAN COHEN ******
30 REM ***** USER: 73565,634 ****************
50 REM ***** [213] 645-2185 *****************
60 REM **************************************
70 E$=CHR$(27)
80 PRINT ""
90 PRINT 
100 LET Y1=1979
110 GOSUB 1580
120 PRINT "ENTER TODAY'S DATE IN THIS FORM: MONTH,DAY,YEAR (NUMBERS ONLY)";
130 INPUT M1,D1,Y1
140 IF M1>12 THEN PRINT " ILLEGAL MONTH, TRY AGAIN" \ PRINT  \ GO TO 120
150 IF D1>31 THEN PRINT " ILLEGAL DAY, TRY AGAIN" \ PRINT  \ GO TO 120
160 IF Y1>100 THEN 180
170 LET Y1=Y1+1900
180 DEF FNA(A)=INT(A/4)
190 DIM T(12)
200 DEF FNB(A)=INT(A/7)
210 FOR I=1 TO 12
220 READ T(I)
230 NEXT I
240 PRINT 
250 PRINT "(ENTER ALL ZERO'S TO END PROGRAM)"
260 PRINT 
270 PRINT "FACTS ABOUT A DATE OF INTEREST TO YOU"
280 PRINT 
290 PRINT "ENTER ANY DATE IN THIS FORM: MONTH,DAY,YEAR--SAMPLE (12,05,1979)";
300 INPUT M,D,Y
310 IF M=0 THEN IF D=0 THEN IF Y=0 THEN 1590
315 PRINT  \ PRINT "IS THIS THE DATE YOU WAS BORN ON"; \ INPUT I$
317 LET I$=SEG$(I$,1,1)
320 IF M=2 THEN IF D>29 THEN PRINT "NO SUCH DAY IN FEBRUARY, TRY AGAIN" \ GO TO 290
330 IF M>12 THEN PRINT "NO SUCH MONTH, TRY AGAIN" \ GO TO 290
340 IF D>31 THEN PRINT "NO SUCH DAY, TRY AGAIN" \ GO TO 290
350 PRINT 
360 IF Y-75>0 THEN 380
370 LET Y=Y+1900
380 LET I1=INT((Y-1500)/100)
390 IF Y-1582<0 THEN 1310
400 LET A=I1*5+(I1+3)/4
410 LET I2=INT(A-FNB(A)*7)
420 LET Y2=INT(Y/100)
430 LET Y3=INT(Y-Y2*100)
440 LET A=Y3/4+Y3+D+T(M)+I2
450 LET B=INT(A-FNB(A)*7)+1
460 IF M>2 THEN 570
470 IF Y3=0 THEN 540
480 LET T1=INT(Y-FNA(Y)*4)
490 IF T1<>0 THEN 570
500 IF B<>0 THEN 520
510 LET B=6
520 LET B=B-1
530 GO TO 570
540 LET A=I1-1
550 LET T1=INT(A-FNA(A)*4)
560 IF T1=0 THEN 500
570 IF B<>0 THEN 590
580 LET B=7
590 IF (Y1*12+M1)*31+D1<(Y*12+M)*31+D THEN 650
600 IF (Y1*12+M1)*31+D1=(Y*12+M)*31+D THEN 630
610 PRINT M;"/";D;"/";Y;" WAS A ";
620 GO TO 660
630 PRINT M;"/";D;"/";Y;" IS A ";
640 GO TO 660
650 PRINT M;"/";D;"/";Y;" WILL BE A ";
660 IF B<>1 THEN 680
670 PRINT "SUNDAY"
680 IF B<>2 THEN 700
690 PRINT "MONDAY"
700 IF B<>3 THEN 720
710 PRINT "TUESDAY"
720 IF B<>4 THEN 740
730 PRINT "WEDNESDAY"
740 IF B<>5 THEN 760
750 PRINT "THURSDAY"
760 IF B<>6 THEN 780
770 GO TO 1260
780 IF B<>7 THEN 800
790 PRINT "SATURDAY"
800 IF (Y1*12+M1)*31+D1=(Y*12+M)*31+D THEN 1200
805 IF I$="N" THEN 1200
810 LET I5=Y1-Y
820 PRINT 
830 LET I6=M1-M
840 LET I7=D1-D
850 IF I7>=0 THEN 880
860 LET I6=I6-1
870 LET I7=I7+30
880 IF I6>=0 THEN 910
890 LET I5=I5-1
900 LET I6=I6+12
910 IF I5<0 THEN 1340
920 IF I7<>0 THEN 950
930 IF I6<>0 THEN 950
940 PRINT "****HAPPY BIRTHDAY*****"
950 PRINT " "," ","YEARS","MONTHS","DAYS"
960 PRINT "YOUR AGE              ",I5,I6,I7
970 LET A8=(I5*365)+(I6*30)+I7+INT(I6/2)
980 LET K5=I5
990 LET K6=I6
1000 LET K7=I7
1010 LET E=Y+65
1020 LET F=.35
1030 PRINT "YOU HAVE SLEPT ",
1040 GOSUB 1360
1050 LET F=.17
1060 PRINT "YOU HAVE EATEN ",
1070 GOSUB 1360
1080 LET F=.23
1090 IF K5>3 THEN 1120
1100 PRINT "YOU HAVE PLAYED ",
1110 GO TO 1160
1120 IF K5>9 THEN 1150
1130 PRINT "YOU HAVE PLAYED/STUDIED",
1140 GO TO 1160
1150 PRINT "YOU HAVE WORKED/STUDIED",
1160 GOSUB 1360
1170 PRINT "YOU HAVE RELAXED ",K5,K6,K7
1180 PRINT 
1190 PRINT " ","** YOU MAY RETIRE IN";E;"**"
1200 PRINT 
1210 FOR Q=1 TO 2
1220 PRINT 
1230 NEXT Q
1240 PRINT 
1250 GO TO 260
1260 IF D=13 THEN 1290
1270 PRINT "FRIDAY "
1275 IF I$="N" THEN 260
1280 GO TO 800
1290 PRINT "FRIDAY THE THIRTEENTH---BEWARE!"
1300 GO TO 800
1310 FOR I=1 TO 4 \ PRINT CHR$(7); \ NEXT I
1320 PRINT "NOT PREPARED TO GIVE DAY OF WEEK PRIOR TO THE YEAR 1582 -"
1330 PRINT "THE CURRENT CALENDER DID NOT EXIST BEFORE THAT YEAR."
1340 GO TO 1210
1350 DATA 0,3,3,6,1,4,6,2,5,0,3,5
1360 LET K1=INT(F*A8)
1370 LET I5=INT(K1/365)
1380 LET K1=K1-(I5*365)
1390 LET I6=INT(K1/30)
1400 LET I7=K1-(I6*30)
1410 LET K5=K5-I5
1420 LET K6=K6-I6
1430 LET K7=K7-I7
1440 IF K7>=0 THEN 1470
1450 LET K7=K7+30
1460 LET K6=K6-1
1470 IF K6>0 THEN 1500
1480 LET K6=K6+12
1490 LET K5=K5-1
1500 PRINT I5,I6,I7
1510 RETURN
1520 IF K6=12 THEN 1540
1530 GO TO 1170
1540 LET K5=K5+1
1550 LET K6=0
1560 GO TO 1170
1570 GO TO 1590
1580 PRINT E$"[H"E$"[2J" \ RETURN
1590 PRINT E$'[H'E$'[2J'
1600 FOR I=1 TO 11 \ PRINT  \ NEXT I
1610 PRINT "******************** END OF PROGRAM ********************"
1620 END
