Java Lab #8: Class Date
In the Figs project create a class Date in package edu.vtc.figs.
Implement the following public methods.
- A constructor taking three integers for the year, month, and day. The constructor
should check the validity of the given date. If it is not valid, it should set the date to
January 1, 1970. Be sure to properly consider month lengths and leap years.
- int getYear(); Returns the year associated with the Date.
- int getMonth(); Returns the month associated with the Date.
- int getDay(); Returns the day associated with the Date.
- boolean isLeapYear(); Returns true if the year associated with the
Date is a leap year; false otherwise.
- void advance(); Advances the Date by one day.
- void advance(int distance); Advances the Date by distance days.
- boolean comesBefore(Date other); Returns true if this Date comes
before other.
- int daysTo(Date future); Computes the number of days between this Date and
future. If future is really in the past, a negative value should be
returned.
Submit your class with suitable comments.