Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ original code please Date Class: Design and Implement a class called Date that has data members to store month (as a number), day, year,

C++ original code please

Date Class: Design and Implement a class called Date that has data members to store month (as a number), day, year, and name of the month. The class should have a three-parameter constructor that allows the data to be set at the time of new Data object instances are created. Default constructor that does not take any parameters should set the default values of 1 (month), 1 (day), 2001 (year). The class should have following three member functions to display date following formats showDate1() should display the date in 1/1/2001 format showDate2() should display the date in January 1, 2001 format showDate3() should display the date in 1 January 2001 format Also the class should have method to set the date (setDate()). This method should take month, day, and year as parameters and set the object instance data member values. Then your Date class should work with the Assignment5.cpp given below and produces the following output. 1/1/2001 February 12, 2010 29 August 1986

Assignment5.cpp

#include using namespace std; #include "Date.h" int main() { Date d1; Date d2(2, 12, 2010); d1.showDate1(); d2.showDate2(); d1.setDate(8, 29, 1986); d1.showDate3(); system("pause"); return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions