Question
Add the following operations to the class dateType, 1) set the month 2) set the day 3) set the year 4) return the month 5)
Add the following operations to the class dateType,
1) set the month
2) set the day
3) set the year
4) return the month
5) return the year
6) test whether the year is a leap year
7) return the number of days in the month
8) return the days passed in the year.
For example, if the date is 3-18-2011, the number of days passed is 77.
Note that the number of days returned also includes the current day.
9) return the number of days remaining in the year. For example, if the
date is 3-18-2011, the number of days remaining in the year is 288.
________________________
date.h
class dateType
{public: void setDate(int month, int day, int year);
//Function to set the date. //The member variables dMonth, dDay, and dYear are set //according to the parameters. //Postcondition: dMonth = month; dDay = day; dYear = year int getDay() const; //Function to return the day. //Postcondition: The value of dDay is returned. int getMonth() const; //Function to return the month. //Postcondition: The value of dMonth is returned. int getYear() const; //Function to return the year. //Postcondition: The value of dYear is returned. void printDate() const; //Function to output the date in the form mm-dd-yyyy. dateType(int month = 1, int day = 1, int year = 1900); //Constructor to set the date //The member variables dMonth, dDay, and dYear are set //according to the parameters. //Postcondition: dMonth = month; dDay = day; dYear = year. If // no values are specified, the default values are used to // initialize the member variables.private: int dMonth; //variable to store the month int dDay; //variable to store the day int dYear; //variable to store the year};
date.cp
#include
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