Question: C++ Design a class called Date. The class should store a date in three integers: month, day and year. There should be a default constructor

C++

Design a class called Date. The class should store a date in three integers: month, day and year. There should be a default constructor that sets the member values to 1st of January 2019, and an overloaded constructor that sets the member values to whatever values passed to it. The constructor should not accept negative numbers and would reset them to be 1.

In addition, there should be two member functions in the class, both return string objects but they do it in different ways:

- StandardFormat(); // YYYY-MM-DD Example: 2019-02-07

- StringFormat(); // Month Day, Year Example: Feb 7, 2019

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!