start:
CLS
SCREEN 0: WIDTH 80, 25: COLOR 1, 7: CLS
COLOR 15, 1: LOCATE 2, 1
PRINT UCASE$("find any day of the week for any date")
PRINT UCASE$("from 1753 to the present.")
PRINT UCASE$("and into the next two centuries beyond...."): PRINT
INPUT "ENTER THE YEAR: "; year
IF year < 1753 THEN PRINT "only dates after 1752.": SLEEP 3: GOTO start
year$ = STR$(year)
yy$ = RIGHT$(year$, 2)
yy = VAL(yy$)
x = INT(yy / 4)
z = (yy + x) MOD 7
ycode = z
PRINT LCASE$(" enter the month written as text ");
: INPUT month$
month$ = LCASE$(month$)
INPUT " enter the day number of the month: "; dnum
REM following are the month codes (predetermined)
IF month$ = "january" THEN mcode = 0
IF month$ = "february" THEN mcode = 3
IF month$ = "march" THEN mcode = 3
IF month$ = "april" THEN mcode = 6
IF month$ = "may" THEN mcode = 1
IF month$ = "june" THEN mcode = 4
IF month$ = "july" THEN mcode = 6
IF month$ = "august" THEN mcode = 2
IF month$ = "september" THEN mcode = 5
IF month$ = "october" THEN mcode = 0
IF month$ = "november" THEN mcode = 3
IF month$ = "december" THEN mcode = 5
REM now the century code
ctury$ = MID$(year$, 2, 2): ctury = VAL(ctury$)
PRINT ctury; " century code."
IF ctury = 17 THEN ccode = 4
IF ctury = 18 THEN ccode = 2
IF ctury = 19 THEN ccode = 0
IF ctury = 20 THEN ccode = 6
IF ctury = 21 THEN ccode = 4
IF ctury = 22 THEN ccode = 2
REM leap year calculation
IF year MOD 4 = 0 AND NOT year MOD 100 = 0 THEN leap = 1
IF year MOD 400 = 0 THEN leap = 1: GOTO here
leap = 0
here:
wrapup:
CLS
answer = (ycode + mcode + ccode + dnum - leap) MOD 7
month$ = UCASE$(month$)
PRINT month$; " "; dnum; " "; year
IF answer = 0 THEN PRINT "Day of the week is Sunday."
IF answer = 1 THEN PRINT "Day of the week is Monday."
IF answer = 2 THEN PRINT "Day of the week is Tuesday."
IF answer = 3 THEN PRINT "Day of the week is Wednesday."
IF answer = 4 THEN PRINT "Day of the week is Thursday."
IF answer = 5 THEN PRINT "Day of the week is Friday."
IF answer = 6 THEN PRINT "Day of the week is Saturday."