Question: Modify the Date class in Programming Challenge 1 of Chapter 13. The new version should have the following overloaded operators: ++ Prefix and postfix increment

Modify the Date class in Programming Challenge 1 of Chapter 13. The new version should have the following overloaded operators: ++ Prefix and postfix increment operators. These operators should increment the object's day member. Prefix and postfix decrement operators. These operators should decrement the object's day member. Subtraction operator. If one Date object is subtracted from another, the operator should give the number of days between the two dates. For example, if April 10, 2014 is subtracted from April 18, 2014, the result will be 8. << couts stream insertion operator. This operator should cause the date to be dis- played in the form April 18, 2014 >> cins stream extraction operator. This operator should prompt the user for a date to be stored in a Date object. The class should detect the following conditions and handle them accordingly: When a date is set to the last day of the month and incremented, it should become the first day of the following month. When a date is set to December 31 and incremented, it should become January 1 of the following year. When a day is set to the first day of the month and decremented, it should become the last day of the previous month. When a date is set to January 1 and decremented, it should become December 31 of the previous year. Demonstrate the classs capabilities in a simple program. Input Validation: The overloaded >> operator should not accept invalid dates. For example, the date 13/45/2014 should not be accepted.

question of chapter 13 Q.1 is below

Design a class called Date. The class should store a date in three integers: month, day, and year. There should be member functions to print the date in the following forms:

12/25/2014 December 25, 2014 25 December 2014

Demonstrate the class by writing a complete program implementing it.

Input Validation: Do not accept values for the day greater than 31 or less than 1. Do not accept values for the month greater than 12 or less than 1.

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!