-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudent.java
107 lines (104 loc) · 2.59 KB
/
Student.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
/** Student class
* Sherwin Chiu and Kyro Nassif
* Visual display of the menu for prom
* 2/13/2020
*/
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Objects;
class Student implements Comparator<Student>{
private String name;
private String id;
private ArrayList<Student> partners;
private boolean paid;
private ArrayList<Student> undesired;
private ArrayList<String> accommodations;
public Student(String name, String id, ArrayList<Student> partners){ //construtor
this.name = name;
this.id = id;
this.partners = partners;
}
public Student(String name, String id){ // constructor
this.name = name;
this.id = id;
}
/**
* @return String
*/
public String getName(){
return this.name;
}
/**
* @return String
*/
public String getId(){
return id;
}
/**
* @return ArrayList<Student>
*/
public ArrayList<Student> getPartners(){
return this.partners;
}
/**
* @param partners
*/
public void setPartners(ArrayList<Student> partners){
this.partners = partners;
}
/**
* @return ArrayList<Student>
*/
public ArrayList<Student> getUndesired(){
return this.undesired;
}
/**
* @param undesired
*/
public void setUndesired(ArrayList<Student> undesired){
this.undesired = undesired;
}
/**
* @return boolean
*/
public boolean hasPaid(){
return this.paid;
}
/**
* @param paid
*/
public void setPaid(boolean paid){
this.paid = paid;
}
/**
* @param o
* @return boolean
*/
@Override
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Student student = (Student) o;
return Objects.equals(name, student.name) && Objects.equals(id, student.id);
}
/**
* @param accommodations
*/
public void setAccommodations(ArrayList<String> accommodations){
this.accommodations = accommodations;
}
/**
* @param s1
* @param s2
* @return int
*/
@Override
public int compare(Student s1, Student s2) {
if (Integer.parseInt(s1.getId()) > Integer.parseInt(s2.getId()))
return 1;
else if (s1.getId().equals(s2.getId()))
return 0;
else
return -1;
}
}