'===========================================================================
' Subject: WEEK OF THE DAY CALCULATOR         Date: 06-28-98 (14:26)       
'  Author: Petter Holmberg                    Code: QB, QBasic, PDS        
'  Origin: petter.holmberg@usa.net          Packet: DATETIME.ABC
'===========================================================================
' Week of the day calculator by Petter Holmberg, -98:

CLS
PRINT "Have you forgotten what day of the week you were born? Do you want to know what"
PRINT "day of the week Jan. 1, 2000 will be? Or have you even forgotten what day it is"
PRINT "today? Don't worry! This program can help you."
PRINT

DO
   INPUT "Enter a date, (yy,mm,dd): ", year%, month%, date%
   PRINT

   SELECT CASE month%
    CASE 1: monthnumber% = 0
    CASE 2: monthnumber% = 3
    CASE 3: monthnumber% = 3
    CASE 4: monthnumber% = 6
    CASE 5: monthnumber% = 1
    CASE 6: monthnumber% = 4
    CASE 7: monthnumber% = 6
    CASE 8: monthnumber% = 2
    CASE 9: monthnumber% = 5
    CASE 10: monthnumber% = 0
    CASE 11: monthnumber% = 3
    CASE 12: monthnumber% = 5
   END SELECT

   IF month% = 1 OR month% = 2 THEN
    IF year% <> 0 THEN
     IF year% \ 4 = year% / 4 THEN monthnumber% = monthnumber% - 1
    END IF
   END IF

   day% = year% + year% \ 4 + date% + monthnumber%
   day% = day% MOD 7

   SELECT CASE day%
    CASE 0: day$ = "Sunday"
    CASE 1: day$ = "Monday"
    CASE 2: day$ = "Tuesday"
    CASE 3: day$ = "Wednesday"
    CASE 4: day$ = "Thursday"
    CASE 5: day$ = "Friday"
    CASE 6: day$ = "Saturday"
   END SELECT

   PRINT "The date you entered was/is/will be a "; day$; "."
   PRINT
   PRINT "Another date (Y/N)?"
   PRINT

   DO
      kbd$ = UCASE$(INKEY$)
   LOOP UNTIL kbd$ = "Y" OR kbd$ = "N"

   IF kbd$ = "N" THEN END
LOOP
