Happydays

Author(s): Hsieh Min Hon
Publication: ZX-Appeal
Pub Details: ZX-Appeal Summer 90
Date: Summer 1990
Pages: 28

THE QUAINTLY-NAMED Happydays is a calendar program which will tell you the day of the week for any given date, as long as it falls after the introduction of the Julian calendar. That will almost certainly include all of our readers’ birthdays, so the program is a good opportunity to discover if you are merry and gay, or work hard for a living, according to the old rhyme.

Enter the day and month as figures, and the year in full, e.g. 1985. Happydays was written by Hsieh Min Hon of Singapore and runs on the ZX-81 in 1K.

  10 PRINT "DAY?"
20 INPUT D
30 PRINT "MONTH?"
40 INPUT M
50 PRINT "YEAR?"
60 INPUT Y
70 LET K=INT (.6+(1/M))
80 LET L=Y-K
90 LET Q=M+12*K
100 LET P=L/100
110 LET A=INT (P/4)
120 LET B=INT (P)
130 LET C=INT ((5*L)/4)
140 LET E=INT (13*(Q+1)/5)
150 LET Z=E+C-B+A+D-1
160 LET Z=(Z-(7*INT (Z/7)))+1
170 PRINT D;"/";M;"/";Y;" IS A
";
180 IF Z=1 THEN PRINT "SUNDAY"
190 IF Z=2 THEN PRINT "MONDAY"
200 IF Z=3 THEN PRINT "TUESDAY"
210 IF Z=4 THEN PRINT "WEDNESDA
Y"
220 IF Z=4 THEN PRINT "THURSDAY
"
230 IF Z=5 THEN PRINT "FRIDAY"
240 IF Z=6 THEN PRINT "SATURDAY
"
250 STOP

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.