-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUser.java
271 lines (241 loc) · 8.11 KB
/
User.java
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
/**
* This class is going to set up a user and pull their information and assign to them so when
* they are working online they can be identified
* @author word.exe
*/
import java.util.ArrayList;
import java.util.UUID;
public class User {
protected String firstName;
protected String lastName;
protected String userName;
protected java.util.UUID userID;
protected java.util.Date dateOfBirth;
protected String phoneNumber;
protected String emailAddress;
protected ArrayList<CourseProgress> courseProgress;
protected String password;
/**
* This class is going to set up the user with all of their information
* @param firstName the first name of the user
* @param lastName the last name of the user
* @param userName the username for the user
* @param password the password for the user
* @param dateOfBirth the date of birth for the user
* @param phoneNumber the phone number for the user
* @param emailAddress the email address for the user
*/
public User(String firstName, String lastName, String userName, String password, java.util.Date dateOfBirth, String phoneNumber, String emailAddress) {
this.firstName = firstName;
this.lastName = lastName;
this.userName = userName;
this.password = password;
this.userID = UUID.randomUUID();
this.phoneNumber = phoneNumber;
this.emailAddress = emailAddress;
this.dateOfBirth = dateOfBirth;
this.courseProgress = new ArrayList<CourseProgress>();
}
/**
* This class is going to set up the user with all of their information
* @param firstName the first name of the user
* @param lastName the last name of the user
* @param userName the username for the user
* @param password the password for the user
* @param userID the UUID of the user
* @param dateOfBirth the date of birth for the user
* @param phoneNumber the phone number for the user
* @param emailAddress the email address for the user
*/
public User(String firstName, String lastName, String userName, String password, java.util.UUID userID, java.util.Date dateOfBirth, String phoneNumber, String emailAddress) {
this.firstName = firstName;
this.lastName = lastName;
this.userName = userName;
this.password = password;
this.userID = userID;
this.phoneNumber = phoneNumber;
this.emailAddress = emailAddress;
this.dateOfBirth = dateOfBirth;
this.courseProgress = new ArrayList<CourseProgress>();
}
/**
* This is going to add courses
* @param course the course being made
*/
public void addCourse(Course course) {
this.courseProgress.add(new CourseProgress(course));
}
/**
* This is going to add courses from the dataLoader
* @param course the course being added
*/
public void addCourse(Course course, ArrayList<Double> grades) {
this.courseProgress.add(new CourseProgress(course, grades));
}
/**
* This is going to allow the user to view the classes
*/
public void viewCourses() {
int count = 0;
for(CourseProgress x: courseProgress) {
System.out.println(count + " " + x.getCourse().getCourseName() + "\n");
count++;
}
}
/**
* This is going to allow the user to select the course they want to complete
* @param courseIndex this is the index of all of the courses
*/
public Course selectCourse(int courseIndex) {
return courseProgress.get(courseIndex).getCourse();
}
/**
* This is going to double check the user login to verify the information to connect to a user
* @param userName the username of the user
* @param password the password the user created
* @return this is going to return true is the user login is valid and false if not valid
*/
public boolean verifyLogin(String username, String passWord) {
return (this.userName.equals(username) && this.password.equals(passWord));
}
/**
* This is going to get the users first name
* @return the users first name
*/
public String getFirstName() {
return this.firstName;
}
/**
* This is going to set the first name to the user
* @param firstName the users first name
*/
public void setFirstName(String firstName) {
this.firstName = firstName;
}
/**
* This is going to get the user's last name
* @return the last name of the user
*/
public String getLastName() {
return this.lastName;
}
/**
* This is going to set the user's last name
* @param lastName the last name of the user
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* This is going to get the user name
* @return the user name
*/
public String getUserName() {
return this.userName;
}
/**
* This is going to set the user name
* @param userName the username of the user
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* This is going to get the ID of the user
* @return the user ID is returned
*/
public java.util.UUID getUserID() {
return this.userID;
}
/**
* This is going to set the user's ID
* @param userID this is going to be the user's ID
*/
public void setUserID(java.util.UUID userID) {
this.userID = userID;
}
/**
* This is going to get the date of birth of the user
* @return the date of birth
*/
public java.util.Date getDateOfBirth() {
return this.dateOfBirth;
}
/**
* This is going to set the date of birth of the user
* @param dateOfBirth this is the date of birth of the user
*/
public void setDateOfBirth(java.util.Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
/**
* This is going to get the phone number of the user
* @return the phone number of the user
*/
public String getPhoneNumber() {
return this.phoneNumber;
}
/**
* This is going to set the phone number of the user
* @param phoneNumber
*/
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
/**
* This is going to get the email of the user
* @return this is going to return the email address
*/
public String getEmailAddress() {
return this.emailAddress;
}
/**
* This is going to set the email address
* @param emailAddress The email address of the user
*/
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
/**
* This is going to get the course progress
* @return The course progress of the user
*/
public ArrayList<CourseProgress> getCourseProgress() {
return this.courseProgress;
}
/**
* This is going to set the course progress
* @param courseProgress this is the course progress
*/
public void setCourseProgress(ArrayList<CourseProgress> courseProgress) {
this.courseProgress = courseProgress;
}
/**
* This is going to get the password of the user
* @return the password of the user
*/
public String getPassword() {
return this.password;
}
/**
* This is going to set the password of the user
* @param password the password of the user
*/
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "{" +
" firstName='" + getFirstName() + "'" +
", lastName='" + getLastName() + "'" +
", userName='" + getUserName() + "'" +
", userID='" + getUserID() + "'" +
", dateOfBirth='" + getDateOfBirth() + "'" +
", phoneNumber='" + getPhoneNumber() + "'" +
", emailAddress='" + getEmailAddress() + "'" +
", courseProgress='" + getCourseProgress() + "'" +
", password='" + getPassword() + "'" +
"}";
}
}