Question: please give a thorough answer with showing the output and separate it into the right 3 files. (main.cpp, date.cpp, date.h) Lab 05 a Date class

please give a thorough answer with showing the output and separate it into the right 3 files. (main.cpp, date.cpp, date.h)
please give a thorough answer with showing the output and separate it
into the right 3 files. (main.cpp, date.cpp, date.h) Lab 05 a Date
class This lab asks you to add, implement and test operator overloading
functions for the following Date class. . The month and day, data
members represent the month and day of a date in a non-leap
year. For example, a month_value of 12 and a day_value of 27
represents December 27 The DAYS array is a class-level data member that
is shared by all Date objects. It contains the number of days
in each month. That is, DAYS[0] contains the number of days for

Lab 05 a Date class This lab asks you to add, implement and test operator overloading functions for the following Date class. . The month and day, data members represent the month and day of a date in a non-leap year. For example, a month_value of 12 and a day_value of 27 represents December 27 The DAYS array is a class-level data member that is shared by all Date objects. It contains the number of days in each month. That is, DAYS[0] contains the number of days for January, DAYS[1] contains the number of days for February, and so on. . const unsigned Date::DAYS[12] (1, 2, 3, 4, 31, 30, 31, 31, 30, 31, 30, 31); The MONTHS array is a class-level data member that is shared by all Date objects. It contains the month names. const string Date: MONTHS (12) anuaryebruary March April May ne uygusti September oktober november December'); . The default constructor sets the month and day, value of a Date object to 1 and 1 representing January 1, . The toString method returns a string representing the date in "MM/DD"format Class Date private: unsigned month day: static const unsigned DAYS (12); statie const string MONTHS (2) public Date std::string tostringo consta 33 Days from 01/01 1 2 29 30 31 32 58 59 60 363 364 365 366 Date 01/01 01/02 01/03 01/30 01/31 02/01 02/02 02/28 03/01 03/02 12/30 12/31 01/01 01/02 . The second operator overloading member function is to support the comparison between two Date objects. The following illustrates the results of some sample testing: 03/28 > 09/30 returns false 09/30 > 03/28 returns true 01/09 > 10/30 returns false 10/30 > 01/09 zeturns true 11/25 > 11/14 returns true 11/14 > 11/25 returns false 08/19 > 04/18 returns true 04/18 08/19 returns false The first non-member, friend operator overloading member function is to support the comparison between a string object on the left and a Date object on the right. We assume the string object takes on the format of "MM/DD For example, given the following Date object Date indepedence_day 184; W/July 4 15 184 days since Jan. 1 The overloaded function shall return true for the following comparisons . 03/14" indepedence day M07/03 indepedence day It shall return false for the following comparisons. 10/31M indepedence day M07/04" indepedence day The second non-member friend operator overloading member function is to support the operator and display the Date object on the right side of using the Month Day format For example, the following code segment shall display July 4 Date indepedence date 1847 cout independence date, And the following code segment shall display October 31 Date halloween = 303) //oct. 31 is 303 days after Jan. 1 cout 2 #include 3 #include 4 #include 5 #include "Date.h" 6 using namespace std; 17 8 Harray static const can't be initialized in the class desantion 9 const unsigned Date: : DAYS[12] {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 10 11 const string Date: : MONTHS[12] {"January", "February", "March April May", June", "July", "August", September October", "November December"}; 12 13 date 14 - Date::Date(): month_(1). day_(1) { churen 16 3 17 18 19 string Date: : toString() const { 20 stringstream s 2.1 s month day 15 6 22 s month /day_; return s.str(); } 28 24 25 26 27 yaddalena vandeadad operato Date.hx 1 2 3 4 5 6 Fifndef DATE_H #define DATE_H #include #include using namespace std; 17 000 9 I 10 11 112 113 14 class Date { private: unsigned month day_; static const unsigned DAYS [12]; static const string MONTHS[12]; public: Date(); std::string toString() const; 16 17 18 19 2012 Date& operator=(unsigned days); bool operator>(const Date& d) const; friend ostream& operator

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!