Write an instance method daysTillXmas that will be placed inside the Date class. The method returns how many days away the Date object is from Christmas, December 25, in the same year. For example, Nov. 22 is 33 days away, Sep. 3 is 113 days away, Dec 25 is 0 days away, and Dec 31 is -6 days away.
Here is program:
class Date
{
public:
void daysTillXmas(int date)
{
till = (365 - xmas) + date;
cout << "Left until christmas - " << till << " days" << endl;
}
private:
int date;
int xmas = 359;
int till;
};
Comments
Leave a comment