previous
|
start
|
next
Implementing a
Day
Class
Straightforward implementation:
private int year
private int month
private int date
addDays
/
daysFrom
tedious to implement
April, June, September, November have 30 days
February has 28 days, except in leap years it has 29 days
All other months have 31 days
Leap years are divisible by 4, except after 1582, years divisible by 100 but not 400 are not leap years
There is no year 0; year 1 is preceded by year -1
In the switchover to the Gregorian calendar, ten days were dropped: October 15, 1582 is preceded by October 4
previous
|
start
|
next