Question: In C++ please Date.h #include using namespace std; class Date { private: int month; int day; int year; public: Date(); Date(int m, int d, int

In C++ please

In C++ please Date.h #include using namespace std; class Date { private:

Date.h

#include using namespace std;

class Date { private: int month; int day; int year; public: Date(); Date(int m, int d, int y); int endOfMonth()const; int getMonth()const; int getDay()const; int getYear()const; void setMonth(int m); void setDay(int d); void setYear(int y); void printDate() const; bool sameMonth(const Date& myDate) const; };

Date.cpp

#include "Date.h" #include using namespace std;

Date::Date() { month=0; day=0; year=0; } Date::Date(int m, int d, int y) { month=m; day=d; year=y; }

int Date::getMonth()const { return month; } int Date::getDay()const { return day; } int Date::getYear()const { return year; } void Date::setMonth(int m) { month=m; } void Date::setDay(int d) { day=d; } void Date::setYear(int y) { year=y; } int Date::endOfMonth() const { int monthEnd=0; switch (month) { case 1: monthEnd=31; break; case 2: if ((year%400==0)||((year%4==0 && year%100!=0))) monthEnd=29; else monthEnd=28; break; case 3: monthEnd=31; break; case 4: monthEnd=30;

case 5: monthEnd=31; break; case 6: monthEnd=30; break; case 7: monthEnd=31; break; case 8: monthEnd=31; break; case 9: monthEnd=30; break; case 10: monthEnd=31; break; case 11: monthEnd=30; break; case 12: monthEnd=31; break; } return monthEnd; }

void Date::printDate() const { cout

main.cpp

#include "Date.h" #include using namespace std;

Date::Date() { month=0; day=0; year=0; } Date::Date(int m, int d, int y) { month=m; day=d; year=y; }

int Date::getMonth()const { return month; } int Date::getDay()const { return day; } int Date::getYear()const { return year; } void Date::setMonth(int m) { month=m; } void Date::setDay(int d) { day=d; } void Date::setYear(int y) { year=y; } int Date::endOfMonth() const { int monthEnd=0; switch (month) { case 1: monthEnd=31; break; case 2: if ((year%400==0)||((year%4==0 && year%100!=0))) monthEnd=29; else monthEnd=28; break; case 3: monthEnd=31; break; case 4: monthEnd=30;

case 5: monthEnd=31; break; case 6: monthEnd=30; break; case 7: monthEnd=31; break; case 8: monthEnd=31; break; case 9: monthEnd=30; break; case 10: monthEnd=31; break; case 11: monthEnd=30; break; case 12: monthEnd=31; break; } return monthEnd; }

void Date::printDate() const { cout

Part 1 I. Change the sameMonth function into a overloaded operator. This will be a member function as demonstrated in the notes. Remember that you will want to compare the month, day, and year. 2. Add an overloaded ++ operator (as a member function, shown in the notes) 3. Just for fun, change the printDate function into an overloaded

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!