-
Notifications
You must be signed in to change notification settings - Fork 0
/
Person.cpp
137 lines (117 loc) · 2.4 KB
/
Person.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// The class Person allows the user to create an object of type Person, offering two constructors (the first being a default).
// Each instance of Person has the following: a urID, netID, last name, first name, birthday (including day, month, and year),
// email address, address, and phone number. There exists a getter and setter method to access or modifiy each value of protected
// data that an instance of Person has.
#ifndef __PERSON_CPP__
#define __PERSON_CPP__
#include "Person.h"
Person::Person()
{
urID = 0;
netID = "0";
lastName = "";
firstName = "";
tmp.tm_yday = 0;
tmp.tm_mon = 0;
tmp.tm_year = 0;
emailAddress = "";
address = "";
phone = 0;
}
Person::Person(const Person& other)
{
urID = other.urID;
netID = other.netID;
lastName = other.lastName;
firstName = other.firstName;
struct tm copyStruct = other.tmp;
tmp.tm_yday = copyStruct.tm_yday;
tmp.tm_mon = copyStruct.tm_mon;
tmp.tm_year = copyStruct.tm_year;
emailAddress = other.emailAddress;
address = other.address;
phone = other.phone;
}
Person::Person(int urid, string netid, string lname, string fname,
int dob_day, int dob_month, int dob_year,
string email, string address, long phone)
{
urID = urid;
netID = netid;
lastName = lname;
firstName = fname;
tmp.tm_yday = dob_day;
tmp.tm_mon = dob_month;
tmp.tm_year = dob_year;
emailAddress = email;
this->address = address;
this->phone = phone;
}
Person::~Person() {}
string Person::getFirstName()
{
return firstName;
}
string Person::getLastName()
{
return lastName;
}
struct tm Person::getDateOfBirth()
{
return tmp;
}
string Person::getAddress()
{
return address;
}
string Person::getNetID()
{
return netID;
}
int Person::getURID()
{
return urID;
}
string Person::getEmail()
{
return emailAddress;
}
long Person::getPhone()
{
return phone;
}
void Person::setFirstName(string fname)
{
firstName = fname;
}
void Person::setLastName(string lname)
{
lastName = lname;
}
void Person::setDateOfBirth(int day, int month, int year)
{
tmp.tm_yday = day;
tmp.tm_mon = month;
tmp.tm_year = year;
}
void Person::setAddress(string address)
{
this->address = address;
}
void Person::setNetID(string netid)
{
netID = netid;
}
void Person::setURID(int urid)
{
urID = urid;
}
void Person::setEmail(string email)
{
emailAddress = email;
}
void Person::setPhone(long number)
{
phone = number;
}
#endif