Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Below is a program that enters a date in to the system. Copy this information in to a file ( * . cpp ) Using

Below is a program that enters a date in to the system.
Copy this information in to a file (*.cpp)
Using comments indicate the behaviors of the class Date. _______________
Using comments indicate the attributes of the class Date. ________________
Using comments indicate the instance of the class Date. _________________
Modify this program to display the date as Month-Day-Year _______________
Add three Accessor functions for Date that returns the respective member values. __________
getMonth(), getDay()& getYear()
Add three Mutator functions for Date that modifies the respective member values. __________
setMonth(), setDay()& setYear()
Add a "default" constructor function that will set the initial date to 1/01/1980.______________
Add a parameterized constructor initialize the values of date, month & year of a new instance. ____________
Add another behavior to the class that will display the 1 year anniversary date. (and call from main() function)
Create another instance of the Date class (using the parameterized constructor) and demonstrate all the behaviors from main().
Add a destructor to this class that will set all member values to 0. #include
using namespace std;
class Date
{
public :
void setDate(int,int,int);
void displayDate();
private:
int month;
int day;
int year;
};
void Date::setDate(int num1, int num2,int num3)
{ if (num11|| num1>12) num1=1;
month = num1;
if (num21|| num2>31) num2=1;
day = num2;
year = num3;
}
void Date::displayDate()
{ cout>anv_mn;
cout"Enter the day of the month: ";
cin>>anv_day;
cout"Enter the year: ";
cin>>anv_yr;
anvsy.setDate(anv_mn,anv_day,anv_yr);
cout
image text in transcribed

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions