Develop a class called Date which will involve a variety of operator overloads. A Date object will store a date in terms of day of month, month and year. You will overload some basic operators for use with these objects, including arithmetic, comparison, and insertion/extraction (I/O) operators.   The Date class must allow for storage of a non-negative quantity of date, in terms of day of month, month and year which will be expressed in the normal date format e.g. 18-4-2018 means 18 April 2018. All values should be non-negative. The day of month should be a correct value e.g. 30th in February is not possible. You should create appropriate member data in your class. All member data must be private. Constructors: • The class should have a default constructor (no parameters), which should initialize the Date as 1-1-1900 • The Date class should also have a constructor with 3 parameters representing day of month, month and year e.g. Date d; //creates a date object initialized to 1-1-1900 Date d2(1, 12, 2017)//create a date object corresponding to 1st December 2017 OPERATOR OVERLOADING: Overload the stream insertion operator << for outputting the Date object Overload the stream extraction operator>> for reading Date object from an input stream. Overload the following comparison operators (<, >, ==, !=) which should return true or     Write the main function that would create objects of Date and demonstrates use of all the operators discussed above. A sample main function is given below:   int main() { Date d1, Date d2(1,2,2017); cin>>d1; if(d1

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Develop a class called Date which will involve a variety of operator overloads. A Date object will
store a date in terms of day of month, month and year. You will overload some basic operators for use
with these objects, including arithmetic, comparison, and insertion/extraction (I/O) operators.

 

The Date class must allow for storage of a non-negative quantity of date, in terms of day of
month, month and year which will be expressed in the normal date format e.g. 18-4-2018
means 18 April 2018. All values should be non-negative. The day of month should be a
correct value e.g. 30th in February is not possible. You should create appropriate member data
in your class. All member data must be private.
Constructors:
• The class should have a default constructor (no parameters), which should initialize
the Date as 1-1-1900
• The Date class should also have a constructor with 3 parameters representing day of
month, month and year
e.g.
Date d; //creates a date object initialized to 1-1-1900
Date d2(1, 12, 2017)//create a date object corresponding to 1st December 2017

OPERATOR OVERLOADING:

  1. Overload the stream insertion operator << for outputting the Date object
  2. Overload the stream extraction operator>> for reading Date object from an
    input stream.
  3. Overload the following comparison operators (<, >, ==, !=) which should return true or

 

 

Write the main function that would create objects of Date and demonstrates use of all the
operators discussed above. A sample main function is given below:

 

int main()
{ Date d1,
Date d2(1,2,2017);
cin>>d1;
if(d1<d2)
cout<<”date”<<d1<<”is before the date ”<<d2<<endl;
if(d1==d2)
cout<<”both dates are the same” <<endl;
cout<<d2<<endl;
return 0;
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY