Making a calendar

I am making a calendar that should just have some basic features. Like setting dates and checking spesific dates. I've made a class for setting dates, which also checks if it's a valid date. For example, a month can't exceed 12, and a day can't exceed 7. Here's the code for that:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
class Calendar {
public:
	void setDate(int d, int m, int y) {

		bool day_check = false; bool month_check = false;

		if (m < Month::January || m > Month::December) {
			cerr << "Month does not exist." << endl;
		}
		else {
			month_check = true;
		}

		if (d < Day::Monday || d > Day::Sunday) {
			cerr << "Day does not exist." << endl;
		}
		else {
			day_check = true;
		}

		if (month_check == true && day_check == true) {
			year = y;
			month = m;
			day = d;
		}
		else {
			cerr << "Error with checking dates!" << endl;
		}
	}

	enum Month {
		January = 1,
		February,
		March,
		May,
		June,
		July,
		August,
		September,
		October,
		November,
		December
	};

	enum Day {
		Monday = 1,
		Tuesday,
		Wednesday,
		Thursday,
		Friday,
		Saturday,
		Sunday
	};

	friend ostream& operator <<(ostream& os, Month m) {
		return os << month_table[m]; // Checking a vector with strings Jan - Dec.
	}
	friend ostream& operator <<(ostream& os, Day d) {
		return os << day_table[d]; // Checking a vector with strings Mon - Sun.
	}

	int getYear() { return year; }
	Month getMonth() { return Month(month); }
	Day getDay() { return Day(day); }

private:
	int year;
	int month;
	int day;
};


But now I'm kinda unsure of how to take it even further. How could I extend my project to make it more like a full program rather than a thing that does one job?

The code works as it is right here. But it's kinda boring just using:
1
2
3
Calendar cal;

cal.setDate(1,2,2017);

Any good ideas on how I can ask the user (of the program) for inputs on dates that should be stored, or maybe another class for "booking" of dates?
Last edited on
Topic archived. No new replies allowed.