Question: C++ code only. Using the attached items. Please create the class 'Date' along with the functions and overloaded operators as described. Commented sections within the
C++ code only. Using the attached items. Please create the class 'Date' along with the functions and overloaded operators as described. Commented sections within the Date.cpp file is the only item that needs to be coded in. The Date.h file has all the data members you need. Thank you.
For clarification these are the areas that need to be coded in within the Date.cpp:
//DefaultConstructor
//Constructor with Parameters
//Date to Days
//Days to Date
//toString
//+
//-
//
//>
//==
If you have any questions or need additional info please ask!





Date "his class will represent a calendar day. For simplicity. we are excluding leap years, and all months have 3'] days. Thus, a yearfor this program has 372 days (3'1 days x i 2). "his class has these data members. - int month - int day - int year You will write the date class to have these functions. Default Constructor The default constructor will initialize the date object to its minimum value: i/'l/O. Constructor "he Date constructor will take 3 integer parameters. day, month, year. If the constructor receives invalid parameters, such as 15 for month, will set that value to ZERO. "he accepted ranges ofthe member variables: day: 1 > 31 month: 1 > 12 year: 0 > inf Getters and Setters You should create a getter and setter method for each member variable. For this assignment we provide these. Note: The getter methods should be constant and their parameter should be a constant reference. toString This function will return a string describing what date the object represents. The format is dd/mm/yyyy. Date date = Date(5, 2, 1999}; cout functions easier. This function takes no input and returns the number of days from the minimum Date. This function is Not provided in the template. int dateToDays() const; daysToDate "his is a Private helper function and will make the +, , functions easier. This function takes aan integer as input and returns a Date. "his is the reverse calculation of dateToDays. This function is Not provided in the template. const Date daysToDate(int ndays} const; + and overload (Date + int) Sometimes it doesn't make sense to add two of the same object together, but rather two different objects. Adding two Time objects together makes more sense than adding two date objects together. People don't use dates that way. Specically, we think of elapsed dates as the number of days elapsed. So for this class. we are only going to add (or subtract) an integer to a Date, which represents the number of days ahead or behind the date. Const Date operator+ (int other) const; const Date operator-(int other) const; Date datel = Date (5, 2, 2021) ; datel = datel + 7; cout and (const& Date other) const; == overload Two date objects are equal when they have the same values for their member variables. bool operator==(const& Date other) const;Current file: Date.cpp Load default template.. #include "Date.h" WNP / /Default Constructor 4 //Constructor with parameters int Date: :getDay() const { return day; } 8 int Date: :getMonth() const { return month; } 9 int Date: :getYear () const { return year; } 10 void Date: : setDay (int h) { day = h; } 11 void Date: : setMonth(int m) { month = m; } 12 void Date: : setYear (int s) { year = s; } 13 14 //dateToDays 15 16 //days ToDate 17 18 //toString 19 20 / / + 21 22 // 23 24 // 27 28 // = =Current file: Date.h - Load default template... 1 #ifndef DATE #define DATE WN #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
