Thursday, 18th October at noon
For this project you will implement a Date class similar to the date class found in the C++ Standard Library. Your date must be able to represent any valid date from 1 January, 1900 into the future accepting only valid input (if invalid, set to default 1 Jan, 1900). For example, 29 February is a valid date for any leap year. Leap years are years that are divisible by 4, with one exception. If the year is divisible by 100 and not by 400 (like 2100), then it is not a leap year. (e.g. 2004 was, 2008 was, 2012 is, 1900 was not, 2100 will not be, 2400 will be, and so on).
Date.h that defines the Date class. It must have 3 private integers to hold the month, day, and year. It also needs the following functions:
Date()Date(int d, int m, int y)Date(Date const & d)~Date()int getDay() const, int getMonth() const, int getYear() constbool setDay(int d), bool setMonth(int m), bool setYear(int y)bool setDate(int d, int m, int y)bool equals(Date const & date) constvoid displayDate() constvoid add(int n) void sub(int n) Date.cpp that implements the above functionality. testDate.cpp to test all functionality of your Date class. Of course I will provide my own testDate to test your Date class when I grade, but you should convince yourself that your code works before turning it in. Date_[yourLastName].h, Date_[yourLastName].cpp, and
testDate_[yourLastName].cpp to the DropBox in Minerva. Make sure your name is on the top of
each file.
You can turn in your files as many times as you
want to Minerva- I will only take the last one submitted.Date_[yourLastName].h Date_[yourLastName].cpp testDate_[yourLastName].cpp
Implement the following extra methods in your Date class.
Date(string date)readDate()int difference(Date const & date) const