|
- 1 REM DAYYEAR
- 4 CLEAR 1000:CLS
- 10 DIM M$(15),S(15)
- 15 DEFINT L
- 20 PRINT TAB(15); "DAY OF YEAR"
- 30 PRINT:PRINT"GIVEN THE MONTH AND DAY OF A PARTICULAR DATE IN THE YEAR
- 40 PRINT"THIS PROGRAM WILL CALCULATE ON WHICH DAY OF THE YEAR THAT DATE
- 50 PRINT"OCCURS. FOR EXAMPLE 02/15 IS THE 46 TH DAY OF THE YEAR. FOR
- 60 PRINT"ALL DATES AFTER FEBRUARY 28 THE PROGRAM PRINTS 2 ANSWERS, ONE
- 70 PRINT"FOR A LEAP YEAR AND ONE FOR NON-LEAP YEARS."
- 75 PRINT"THE PROGRAM ALSO GIVES THE NUMBER OF DAYS FROM THE PRESENT
- 80 PRINT"DATE TO THE PREVIOUSLY ENTERED DATE. A NEGATIVE HERE MEANS
- 85 PRINT"THAT THE PRESENT DATE COMES LAST. THIS PART OF THE PROGRAM
- 90 PRINT"GIVES AN INCORRECT ANSWER FOR FEBRUARY 29 DURING LEAP YEAR.
- 95 PRINT:INPUT"PRESS ENTER TO BEGIN";Z9$
- 97 FOR LL=1 TO 12:READ M$(LL):NEXT:REM READ MONTHS IN
- 98 FOR LL=1 TO 13:READ S(LL):NEXT:REM READ 1ST DAY OF MONTH DATA
- 100 CLS
- 110 INPUT"ENTER MONTH OF DESIRED DATE IN NUMERICAL MM FORM";MM
- 115 IF MM<1 OR MM>12 OR MM<>INT(MM) THEN GOSUB 10000:GOTO 110
- 120 PRINT"ENTER DAY OF ";M$(MM);" DESIRED";:INPUT DD
- 125 IF MM=2 AND DD=29 THEN GOTO 150
- 130 IF DD<>INT(DD) OR DD<1 OR DD>S(MM+1)-S(MM) THEN GOSUB 10000:GOTO 120
- 150 PRINT:PRINT
- 160 PRINT M$(MM);DD;" IS DAY NUMBER ";S(MM)+DD;" OF THE YEAR."
- 170 PRINT
- 180 IF MM>2 THEN PRINT "DURING A LEAP YEAR "; M$(MM);DD;" IS DAY NUMBER ";S(MM)+DD+1;" OF THE YEAR."
- 182 PRINT:PRINT"NUMBER OF DAYS FROM LAST DATE = ";S(MM)+DD-JR
- 183 IF JM<=2 AND MM>2 THEN PRINT"NUMBER OF DAYS FROM LAST DATE DURING LEAP YEAR = ";S(MM)+DD+1-JR
- 184 IF JM>2 AND MM<=2 THEN PRINT"NUMBER OF DAYS FROM LAST DATE DURING LEAP YEAR = ";S(MM)+DD-JR-1
- 185 JR=S(MM)+DD:JM=MM
- 190 PRINT:PRINT
- 195 INPUT"PRESS ENTER FOR MORE COMPUTATIONS";Z9$
- 197 IF Z9$ = "-1" THEN END
- 199 GOTO 100
- 900 DATA JANUARY,FEBRUARY,MARCH,APRIL,MAY,JUNE,JULY,AUGUST
- 910 DATA SEPTEMBER,OCTOBER,NOVEMBER,DECEMBER
- 920 REM NO. OF DAYS TO FIRST DAY OF MONTH DATA
- 930 DATA 0,31,59,90,120,151,181,212,243,273,304,334,365
- 10000 PRINT"INPUT ERROR! TRY AGAIN":FOR JJ=1 TO 300:NEXT:RETURN
|