Question: Write a C++ program: Programming Projects 2.23. Implement a simple Date class.You should be able to represent any date from January 1, 1800, through December
Write a C++ program:


Programming Projects 2.23. Implement a simple Date class.You should be able to represent any date from January 1, 1800, through December 31, 2500, subtract two dates, increment a date by a number of days, and compare two dates by using A Date is represented internally as the number of days since some starting time, which here is the first day of 1800 making most operations except for lyo trivial. The rule for leap years is: A year is a leap year if it is divisible by 4, and not divisible by 100 unless it is also divisible by 400. Thus 1800, 1900, and 2100 are not leap years, but 2000 is. The input operation must check the validity of the input. The output operation must check the validity of the Date. The Date could be bad if a or operator caused it to go out of range Figure 2.29 gives a class specification skeleton for the Date class. Several items are missing, including public and private keywords, const and &, and I/o interfaces. Before you begin cod ing the interface, you must make some decisions: 93 Exercises 1 class Date 3 enum FIRST YEAR 1800, IMAX YEAR. 2500 int total Days: Days since 1/1/1800 Constructor. Date int y FIRST YEAR int m 1, int d 1 10 Assignment operator instead of 11 Date operator int days 12 13 Binary operators 14 int operator Date right 15 bool operator Date right 16 Figure 2.29 Class specification skeleton for Date (Exercise 2.23)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
