Question
in programming exercise 2, the class dataType was desifned and implemented to keep track of a data, but it has very limited operations. Redefine the
in programming exercise 2, the class dataType was desifned and implemented to keep track of a data, but it has very limited operations. Redefine the class dataType so that it can perform the following operations on a data, in addition to the operations already defined.
Shoud Include
//***********************************************************************
Header file (dateType.h), Implementation files (dateTypeImp.cpp) Your main program, and your documentation files.
The dateType header file must contain the following functional prototypes:
void setDate(int, int, int);
void setMonth(int);
void setDay(int);
void setYear(int);
void print() const;
int numberOfDaysPassed();
int numberOfDaysLeft();
void incrementDays(int nDays);
int getMonth() const;
int getDay() const;
int getYear() const;
int getDaysInMonth();
bool isLeapYear();
dateType(int = 1, int = 1, int = 1900);
//******************************************************************
Should Include
//***************************************************************
Validate compilation of your header file with the following code. The test program will exercise all functions in the dateType class listed above.
#include
#include
#include "dateType.h"
using namespace std;
int main()
{
dateType date1(3, 15, 2008);
date1.print();
date1.setDate(10,10,2010);
date1.print();
date1.setMonth(12);
date1.setDay(12);
date1.setYear(2012);
date1.print();
cout << "Elapsed Days since 1/1/2012 = " << numberOfDaysPassed() << endl
<< " Days remaining in 2012 = " << numberOfDaysLeft() << endl;
date1.incrementDays(378); //add 378 days to the current date
cout << date1.getMonth() <<"/" << date1.getDay() << "/" << date1.getYear() << "/ ";
cout << "There are " << getDaysInMonth() << " days in this month "
<< "and this year " << isLeapYear() ? "is" : "is not"
<< " a leap year. ";
return 0;
}
//*********************************************************************************
The Result should look like below.
-------------------------------------------------------------------------------------------------
Set date1= 3-15-2008
Change date1= 10-10-2010
Change month to 6 : 6-10-2010
Change day to 15: 6-15-2010
Change year to 2015: 6-15-2015
Elasped Day since 1/1 = 166
Days remaining in year: 199
Adding 366 days to 6-15-2015
The new Data is : 6/15/2016
There are 30 days in this month and this year is a leap year.
-----------------------------------------------------------------------------------------
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started