-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSMUser.cpp
92 lines (77 loc) · 1.42 KB
/
SMUser.cpp
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
* SMUser.cpp
*
* Created on: May 15, 2023
* Author: abdullah ahmed
*/
#include "SMUser.hpp"
#include "Date.hpp"
SMUser::SMUser() {
// TODO Auto-generated constructor stub
this->firstName = "";
this->lastName = "";
this->userID = "";
}
SMUser::~SMUser() {
// TODO Auto-generated destructor stub
}
const Date& SMUser::getDateOfMemberShip() const {
return dateOfMemberShip;
}
bool SMUser::setDateOfMemberShip(const Date &dateOfMemberShip) {
if (dateOfMemberShip.getDay() == 0 || dateOfMemberShip.getMonth() == 0 || dateOfMemberShip.getMonth() == 0)
{
throw "Dates must be valid";
return false;
}
else
{
this->dateOfMemberShip = dateOfMemberShip;
return true;
}
}
const string& SMUser::getFirstName() const {
return firstName;
}
bool SMUser::setFirstName(const string &firstName) {
if (firstName == "")
{
throw "Strings cannot be blank";
return false;
}
else
{
this->firstName = firstName;
return true;
}
}
const string& SMUser::getLastName() const {
return lastName;
}
bool SMUser::setLastName(const string &lastName) {
if (lastName == "")
{
throw "Strings cannot be blank";
return false;
}
else
{
this->lastName = lastName;
return true;
}
}
const string& SMUser::getUserId() const {
return userID;
}
bool SMUser::setUserId(const string &userId) {
if (userId == "")
{
throw "Numbers cannot be blank";
return false;
}
else
{
this->userID = userId;
return true;
}
}