create a class called Date that contains data members representing day month, year of a particular date. A. Add a constructor who initializes the value of date as 1/1/2001 and displays the date by calling a member function to-string that represents the date in the form of “Day/Month/year”. B. Output the Date in multiple formats such as a. DD YYYY b. MM/DD/YYYY c. DD.MM.YYYY d. June 14, 2001 C. Use overloaded constructor to create Date objects initialized with dates of the format in part (b). D. Create a Date constructor that reads the system date using standard library function of the header and sets the data members. a. https://onlinegdb.com/NaakQKYJI (Refer this code for the usage of ctime) b. C++ Date and Time (tutorialspoint.com) (Go through this for more understanding) E. Add a destructor to the program displaying a suitable msg.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
create a class called Date that contains data members representing day month, year of a
particular date.
A. Add a constructor who initializes the value of date as 1/1/2001 and displays the date by calling a
member function to-string that represents the date in the form of “Day/Month/year”.
B. Output the Date in multiple formats such as
a. DD YYYY
b. MM/DD/YYYY
c. DD.MM.YYYY
d. June 14, 2001
C. Use overloaded constructor to create Date objects initialized with dates of the format in part
(b).
D. Create a Date constructor that reads the system date using standard library function of the
<ctime> header and sets the data members.
a. https://onlinegdb.com/NaakQKYJI (Refer this code for the usage of ctime)
b. C++ Date and Time (tutorialspoint.com) (Go through this for more understanding)
E. Add a destructor to the program displaying a suitable msg.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 3 images