Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C++ include all files This lab has been designed for you to practice implementing and testing overloaded operators for a Date class. The 05_date

image text in transcribed

image text in transcribed

image text in transcribed

in C++

include all files

This lab has been designed for you to practice implementing and testing overloaded operators for a Date class. The 05_date project contains the following Date class in the "Date.h" file. class Date \{ private: unsigned month_, day_; public: Date( ); Date(unsigned m, unsigned d); string to_string() const; 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 2 and a day_value of 14 represents February 14. You are given the following member functions: - The default constructor sets the date to January 1. - The fill constructor takes two unsigned variables m and d and uses them to set the month_ and day_data members. - The to_string method returns a string representing the invoking Date object in the "M/D" format. For example, the function returns " 2/14 " for an invoking object whose month_value is 2 and day_ value is 14 . The function returns " 10/4 " for an invoking object whose month_value is 10 and day_ value is 4. You are encouraged to use this function in the main function to help you test the other functions. You are asked to implement the following overloaded operators for the Date class in the "Date.cpp" file and test them in the "main.cpp" file. bool operator >= (const Date\& d) const; This accessor function overloads the >= operator to support the comparison between two Date objects. The following illustrates the results of some sample testing: Testing>=:2/142/142/142/142/14>=1/31>=2/1>=2/14>=10/28>=7/4returnstruereturnstruereturnstruereturnsfalsereturnsfalse Date\& operator += (unsigned days); This mutator function overloads the += operator to support the adjustment of the invoking Date object by adding a few more days. For example, for an invoking object representing February 14 , adding 1 day shall adjust the object to February 15 . But for an invoking object representing December 31, adding 2 days shall adjust the object to January 2 . To simplify the problem, you may assume the value of the days parameter would never exceed 20 . The following illustrates the results of some sample testing: This non-member, friend function overloads the

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago