Login

Date class (Java)

School project
Finished
04 August 2006

Oblig 1:

You will develop a simple date class

The Class is supposed to:

  • Represent any date from 1. January 1800 to 31. December 2500.
  • Subtract two dates (return number of days in between)
  • Increment a date with a number of days
  • Compare two dates, both with equals and compareTo

The date is going to be represented with numbers of days since a start date (01.01.1800). This will make most methods (exception is constructors and toStrings) rather simple to implement. The Challenge is in the conversion between internal and external representation.

Leap Year.
The rule is as follows: A year that can be divided by 4 is a leap year. The exception is years that can be divided by 100 (but not divided by 400). Which will make 1800, 1900 and 2100 not leap year, while 2000 is.

The grade that will be given is approved/not approved.

Grade given: Approved

You have to be logged in to download the project files!
If you are interested in the project files then contact me