Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 #include "date.h"using namespace std;void dateType::setDate(int month, int day, int year){ dMonth = month; dDay = day; dYear = year;}int dateType::getDay() const { return dDay;}int dateType::getMonth() const { return dMonth;}int dateType::getYear() const { return dYear;}void dateType::printDate() const{ cout << dMonth << "-" << dDay << "-" << dYear;} //Constructor with parametersdateType::dateType(int month, int day, int year) { setDate(month, day, year);}

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

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

What are the advantages of planning ?

Answered: 1 week ago

Question

Explain the factors that determine the degree of decentralisation

Answered: 1 week ago

Question

What Is acidity?

Answered: 1 week ago

Question

Explain the principles of delegation

Answered: 1 week ago

Question

State the importance of motivation

Answered: 1 week ago