Correction

Publication: The Plotter
Pub Details: The Plotter v10 n7 (Volume 10, Issue 7)
Pages: 3

The August 1991 issue of The Plotter carried a program that was intended to produce the day of a week based on the input of the month, day of the month, and year. I recenty had occasion to use this program to determine the year that October 16 fell on Saturday, 1937 or 1938. It so happens that 1937 was the correct year. However, the program will not run Sinclair BASIC but will run in GWBASIC mode on a MSDOS compatable computer.

The error exists in line #200. GWBASic accepts multiple inputs in one line but Sinclair BASIC will not. The solution is to make a separate number for each of the 3 inputs. The correct program follows.

110 DIM D$(7)
120 LET D$(1)="MON"
130 LET D$(2)="TUE"
140 LET D$(3)="WED"
150 LET D$(4)="THU"
160 LET D$(5)="FRI"
170 LET D$(6)="SAT"
180 LET D$(7)="SUN"
190 PRINT "DATE (MM,DD,YYYY)";
200 INPUT M: PRINT M;" ";
202 INPUT D: PRINT D;" ";
204 INPUT Y: PRINT Y
205 IF D<0 THEN GO TO 640
210 GO SUB 500
220 PRINT D$(Z)
230 GO TO 190
510 LET N=INT (.6+1/M)
520 LET L=Y-N
530 LET P=M+12*N
540 LET C=L/100
550 LET Y1=INT (C)
560 LET Z1=INT (C/4)
570 LET Z3=INT (5*L/4)
580 LET Z4=INT (13*(P+1)/5)
590 LET Z=Z4+Z3-Y1+Z1+D+5
600 LET Z=Z-(7*INT (Z/7))+1
610 RETURN

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