I have to write two classes, date and event. The Date class will use integers to
ID: 3622279 • Letter: I
Question
I have to write two classes, date and event. The Date class will use integers to store the day, month, and year. For example, it might be used like this to keep track of the date for Thanksgiving in 2010, and New Years Eve 2010.
Date *thanksgiving2010 = new Date(25, 11, 2010);
Date *newYearsEve2010 = new Date(31, 12, 2010);
The Event class uses date objects to represent the start and end of a multi-day event. Here is a line that constructs an event to represent the holiday season in 2010.
Event *holidays2010(thanksgiving2010, newYearsEve2010, “holiday season”);
Here are the classes public member functions, constructors, and class functions:
Date Class
Date(int day, int month, int year);
int getDay();
void setDay(int value);
int getMonth();
void setMonth(int value);
int getYear();
void setYear(int value);
static bool isLeapYear(int year);
static int daysInMonth(int month, int year);
Event Class
Event(Date *start, Date end, const char *title);
Date *getStartDate();
void setStartDate(Date *start);
Date *getEndDate();
void setEndDate(Date *start);
int eventDurationInDays();
the Date class has two static member functions. For the isLeapYear you should see if the year is evenly divisible by 4, but not by 1000. For the daysInMonth function, it was suggested that I give my Date class a static pointer to an array of 12 integers. Each element in the array should represent the days in the corresponding month. As well I am trying to experiment with making the Event class a friend of the Date class.
I have to submit five files: Date.h, Date.cpp, Event.h, Event.cpp, and testProgram.cpp. I really need help writing this so If any of this does not make sense please message me!! Thank you so much! Any help is greatly appreciated!
Explanation / Answer
Not sure I understand what the question here. If you ask to verify all seems ok than yes, looking fine :)