-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDate.h
More file actions
43 lines (41 loc) · 1 KB
/
Date.h
File metadata and controls
43 lines (41 loc) · 1 KB
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
#ifndef MYNAMESPACE_DATE_H
#define MYNAMESPACE_DATE_H
#include "MyNamespace.h"
#include <iostream>
#include <stdexcept>
#include <limits>
#include <sstream>
#include <string>
namespace MyNamespace {
class Date {
private:
int day;
int month;
int year;
static bool isValidDate(int d, int m, int y);
static int daysInMonth(int m, int y);
static bool isLeapYear(int y);
public:
int countDaysPassed();
int countDaysRemaining();
static Date* currentDate;
Date(int d, int m, int y);
Date(const Date& other);
Date& operator=(const Date& other) = default;
Date addDays(int d);
static void setInitialDate();
static Date* getCurrentDate();
int compareDates () const;
int getDaysPassed(int compareDates);
int getDay() const;
int getMonth() const;
int getYear() const;
void setDay(int d);
void setMonth(int m);
void setYear(int y);
std::string displayDate() const;
bool handleInput(int& component, const std::string& errorMessage);
bool operator==(const Date& other) const;
};
}
#endif