Lab 7: Week of Sep 15-Sep 21
 



Write a class Date where a date is defined by suitable positive integers
for day, month and year.

Below (d,m,y) represents a date. Write functions to do the following
(all should be public static):

boolean isLegal(int d, int m, int y)
– true if (d,m,y) defines a legal date false otherwise.

boolean isBefore(int d1, int m1, int y1, int d2, int m2, int y2)
– true if the date (d1,m1,y1) is strictly earlier than date (d2,m2,y2),
false otherwise.

int daysBetween( int d1, int m1, int y1, int d2, int m2, int y2 )
- difference in days between dates (d1,m1,y1) and (d2,m2,y2).
Either of them could be the earlier date.
The difference is 0 exactly when the two dates are identical.

void findDate(int d1, int m1, int y1, int daysElapsed)
– prints out the date as d-m-y after daysElapsed number of days from the
date (d1,m1,y1).
daysElapsed can be positive (future dates) or negative (past dates).

Use helper functions to make your code readable and elegant where
necessary. The rule for leap years is: a year is a leap year if the year
is divisible by 4, however if the year is a century year then it should
be divisible by 400. So 1900 is not a leap year but 2000 is a leap year.