forked from alexs2112/Scholarship-Thing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Applicant.java
157 lines (118 loc) · 4.29 KB
/
Applicant.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
import java.util.ArrayList;
import java.io.*;
public class Applicant extends User implements Comparable {
private static final long serialVersionUID = 1060623638149583738L;
private String studentType; //Student Type: Undergrad, Graduate, PostGrad
private String faculty; //The faculty the applicant belongs to
private String department; //The department the applicant belongs to
private double GPA; //The applicants GPA
private Integer level; //the access permission of the applicant
private String id; //the applicants student id
private ArrayList<Recommendations> recommendations; //a list of recommendations the student has (the professor who recommended them and the award they've been recommended for)
private ArrayList<Scholarship> applications; //a list of scholarships the applicant has applied for
private ArrayList<File> studentFiles; //a list of Files that have been saved to the applicant (Transcripts, references, etc)
private ArrayList<Scholarship> awards; //a list of scholarships that the student has been awarded
private ArrayList<Scholarship> accepted;//a list of scholarships that the student has accepted to receive
//returns the ArrayList of Scholarships the student has been selected to receive (before the accept or decline)
public ArrayList<Scholarship> awards() {
return awards;
}
//retuns the ArrayList of Scholarships the student has accepted and will receive
public ArrayList<Scholarship> acceptedAwards() {
return accepted;
}
//adds an award to the students ArrayList of awarded Scholarships
public void addAward(Scholarship award) {
awards.add(award);
}
//Constructor for Applicant
public Applicant(String name, String id, String studenttype, String fac, String dep, double gpa, String username, String password, String role) {
super(name, role, username, password);
this.id = id;
this.studentType = studenttype;
this.faculty = fac;
this.department = dep;
this.GPA = gpa;
this.applications = new ArrayList<Scholarship>();
this.studentFiles = new ArrayList<File>();
this.recommendations = new ArrayList<Recommendations>();
this.awards = new ArrayList<Scholarship>();
this.accepted = new ArrayList<Scholarship>();
}
//Updates the applicants information
public void update(String firstName, String lastName, String id, String type, String faculty,
String department, double gpa, String email) {
this.name = firstName + " " + lastName;
this.id = id;
this.studentType = type;
this.faculty = faculty;
this.department = department;
this.GPA = gpa;
this.email = email;
}
//Getters and Setters for Applicant
public void setStudentType(String studenttype) {
this.studentType = studenttype;
}
public String getStudentType() {
return studentType;
}
public void setFaculty(String fac) {
this.faculty = fac;
}
public String getFaculty() {
return faculty;
}
public void setDepartment(String dep) {
this.department = dep;
}
public String getDepartment() {
return department;
}
public void setGPA(double gpa) {
this.GPA = gpa;
}
public double getGPA() {
return GPA;
}
public void setLevel(Integer lev) {
this.level = lev;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return email;
}
public Integer getLevel() {
return level;
}
public String id() {
return id;
}
public ArrayList<Scholarship> applications() {
return applications;
}
public void addApplication(Scholarship x) {
applications.add(x);
}
public void addStudentFile(File file) {
studentFiles.add(file);
}
public void addProfRec(Recommendations recom) {
recommendations.add(recom);
}
public ArrayList<Recommendations> getRecs() {
return recommendations;
}
@Override
public int compareTo(Object user) {
//A method to use collections.sort() on applicants
double compare = ((Applicant)user).getGPA();
//Done in descending order, each professor that recommends this student adds a virtual
//4 to this students GPA, after sorting students that are eligible for the award
//So first every applicant that surpasses the GPA req gets added to a list, then
//it sorts the arraylist by this logic here, before awarding the top x students
return (int)(compare - this.getGPA() - (this.recommendations.size() * 4));
}
}