forked from Vidhee1411/Internship-Application
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResume.java
336 lines (299 loc) · 10.9 KB
/
Resume.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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
/**
* The resume class creates a resume of the student in the internship system.
* @author Vidhee Patel and Joshua DuPuis
*/
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
public class Resume {
private String studentFirstName;
private String studentLastName;
private String studentUSCEmail;
private String yearInSchool;
private ArrayList<String> skills;
private ArrayList<String> classes;
private ArrayList<Education> education;
private ArrayList<WorkExperience> workExperiences;
/**
* The default resume constructor creates a resume and sets all of the
* instance variables equal to null
*/
public Resume() {
studentFirstName = "";
studentLastName = "";
studentUSCEmail = "";
yearInSchool = "";
}
/**
* The parameterized resume constructor creates a resume object and sets
* the instance variables corresponding to the students first name, last
* name, email, and year in school equal to the values the user enters.
* @param firstName The first name of the student
* @param lastName The last name of the student
* @param email The school email of the student
* @param yearInSchool The student's year in school
*/
public Resume(String firstName, String lastName, String email, String yearInSchool) {
this.studentFirstName = firstName;
this.studentLastName = lastName;
this.studentUSCEmail = email;
this.yearInSchool = yearInSchool;
skills = new ArrayList<String>();
classes = new ArrayList<String>();
education = new ArrayList<Education>();
workExperiences = new ArrayList<WorkExperience>();
}
/**
* The second Resume parameterized constructor creates a resume object that
* the dataLoader will use to load all student resumes.
* @param firstName The firstName of a student
* @param lastName The lastName of a student
* @param email The email of a student
* @param yearInSchool The student's year in school
* @param skills Skills the student has
* @param classes Classes the student has taken
* @param education Education institutions the student has attended
* @param workExperiences Previous work experiences the student has
*/
public Resume(String firstName, String lastName, String email, String yearInSchool, ArrayList<String> skills, ArrayList<String> classes, ArrayList<Education> education, ArrayList<WorkExperience> workExperiences) {
this.studentFirstName = firstName;
this.studentLastName = lastName;
this.studentUSCEmail = email;
this.skills = skills;
this.classes = classes;
this.education = education;
this.workExperiences = workExperiences;
this.yearInSchool = yearInSchool;
}
/**
* The editFirstName method allows a student to edit their first name on
* their resume.
* @param firstName The new first name of the student
*/
public void editFirstName(String firstName) {
this.studentFirstName = firstName;
}
/**
* The editLastName method allows a student to edit their last name on
* their resume.
* @param lastName The new last name of the student
*/
public void editLastName(String lastName) {
this.studentLastName = lastName;
}
/**
* Teh editEmail method allows a student to edit their email on their
* resume.
* @param email The student's new email
*/
public void editEmail(String email) {
this.studentUSCEmail = email;
}
/**
* The editYearInSchool method allows a student to edit their year in
* school.
* @param year The student's new year in school
*/
public void editYearInSchool (String year) {
this.yearInSchool = year;
}
/**
* The addSkill method allows a student to add a skill to their resume
* @param skill
*/
public void addSkill(String skill) {
skills.add(skill);
}
/**
* The addClass method allows a student to add a class that they have
* taken to their resume.
* @param className The name of the class to add
*/
public void addClass(String className) {
classes.add(className);
}
/**
* The addCExperience method allows a student to add a previous
* WorkExperience to their resume.
* @param experience The student's previous work experience
*/
public void addExperience(WorkExperience experience) {
workExperiences.add(experience);
}
/**
* The addEducation method adds an Education to a student's resume.
* @param education The education to be added to the resume
*/
public void addEducation(Education education) {
this.education.add(education);
}
/**
* The removeSkill method removes a skill from a student's resume if the
* skill is on their resume.
* @param skill The skill to be removed from the resume
*/
public void removeSkill(String skill) {
if (skills.contains(skill)){
this.skills.remove(skill);
}
}
/**
* The removeClass method removes a class from a student's resume if it
* is on their resume.
* @param className The name of the class to be removed
*/
public void removeClass(String className) {
if (classes.contains(className)) {
this.classes.remove(className);
}
}
/**
* The removeExperience method removes an experience from a student's
* resume if it is on their resume.
* @param experience The experience to be removed from the resume
*/
public void removeExperience(WorkExperience experience) {
if (this.workExperiences.contains(experience)) {
this.workExperiences.remove(experience);
}
}
/**
* The removeEducation method removes an education from a student's resume
* if it is on their resume.
* @param education The Education to be removed from the resume
*/
public void removeEducation(Education education) {
if (this.education.contains(education)) {
this.education.remove(education);
}
}
/**
* The getFristName method returns the first name of the student.
* @return The first name of the student
*/
public String getFirstName() {
return this.studentFirstName;
}
/**
* The getLastName method returns the last name of the student.
* @return The last name of the student
*/
public String getLastName() {
return this.studentLastName;
}
/**
* The getEmail method returns the student's school email.
* @return The student's school email
*/
public String getEmail() {
return this.studentUSCEmail;
}
/**
* The getYearInSchool method returns the student's year in school.
* @return The student's year in school
*/
public String getYearInSchool() {
return this.yearInSchool;
}
/**
* The getSkills method returns the skills on the student's resume.
* @return A list of the skills on the student's resume
*/
public ArrayList<String> getSkills() {
return this.skills;
}
/**
* The getClasses method returns the classes on the student's resume.
* @return A list of the classes on the student's resume
*/
public ArrayList<String> getClasses() {
return this.classes;
}
/**
* The getEducation method returns the education experiences on the
* student's resume.
* @return A list of the education experiences on the student's resume
*/
public ArrayList<Education> getEducation() {
return education;
}
/**
* sets the education ArrayList to the one passed to the method
* @param education an ArrayList<Education> containing all education objects for the resume
*/
public void setEducation(ArrayList<Education> education){
this.education = education;
}
/**
* The getExperiences method returns the previous work experiences on the
* student's resume.
* @return The previous work experiences on the student's resume
*/
public ArrayList<WorkExperience> getExperiences() {
return workExperiences;
}
/**
* sets the workExperience ArrayList to the on passed to the method
* @param work an ArrayList<WorkExperience> containing all the WorkExperience objects for the resume
*/
public void setWorkExperience(ArrayList<WorkExperience> work){
this.workExperiences = work;
}
/**
* writes the resume to a txt file
*/
public void toFile(){
try {
File myObj = new File("resume.txt");
myObj.createNewFile();
FileWriter writer = new FileWriter("resume.txt");
writer.write(this.studentFirstName + " " + this.studentLastName + "\n");
writer.write("Year In School: " + this.yearInSchool + "\n");
writer.write("Contact: " + this.studentUSCEmail + "\n");
writer.write("\n--------------------------\nEducation:\n");
for(Education education: this.education){
writer.write(education.toString());
}
writer.write("--------------------------\nClasses: \n");
for(String class_: this.classes){
writer.write(" - " + class_ + "\n");
}
writer.write("--------------------------\nPrevious Work Experience: \n");
for(WorkExperience work: this.workExperiences){
writer.write(work.toString() + "\n");
}
writer.write("--------------------------\nSkills: \n");
for(String skill: skills){
writer.write(" - " + skill + "\n");
}
writer.write("--------------------------\n");
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* The toString method returns a string containing all of the information
* in the resume.
* @return The String representation of the resume
*/
public String toString() {
String ret = "\n" + studentFirstName + " " + studentLastName + "\nYear In School: " + yearInSchool + "\nContact: " + studentUSCEmail + "\n--------------------------\nEducation:\n";
for (Education ed: education) {
ret += ed.toString();
}
ret += "--------------------------\nClasses: \n";
for(String class1: classes) {
ret += " - " + class1 + "\n";
}
ret += "--------------------------\nPrevious Work Experience: \n";
for (WorkExperience we: workExperiences) {
ret += we.toString() + "\n";
}
ret += "--------------------------\nSkills: \n";
for (String skill: skills) {
ret += " - " + skill + "\n";
}
return ret + "--------------------------\n";
}
}