Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help fixing this code // file Chrono.h using namespace std; namespace Chrono { class Date { public: enum Month { jan=1, feb, mar,

I need help fixing this code

// file Chrono.h

using namespace std;

namespace Chrono {

class Date {

public:

enum Month {

jan=1, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec

};

class Invalid { }; // to throw as exception

Date(int y, Month m, int d); // check for valid date and initialize

Date(); // default constructor

// the default copy operations are fine

// nonmodifying operations:

int day() const { return d; }

Month month() const { return m; }

int year() const { return y; }

// modifying operations:

void add_day(int n);

void add_month(int n);

void add_year(int n);

private:

int y;

Month m;

int d;

};

bool is_date(int y, Date::Month m, int d); // true for valid date

bool leapyear(int y); // true if y is a leap year

bool operator==(const Date& a, const Date& b);

bool operator!=(const Date& a, const Date& b);

ostream& operator<<(ostream& os, const Date& d);

istream& operator>>(istream& is, Date& dd);

Date day_of_week(const Date& d); // day of week of d

Date next_Sunday(const Date& d); // next Sunday after d

Date next_weekday(const Date& d); // next weekday after d

const Date& defualt_date();

} // Chrono

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

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

How do you determine the load-bearing capacity of a soil?

Answered: 1 week ago

Question

what is Edward Lemieux effect / Anomeric effect ?

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago