-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudents.java
54 lines (43 loc) · 1.14 KB
/
Students.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
public class Students {
protected String name = "";
protected char gender;
Date birthDay = new Date();
Preference pref = new Preference();;
protected Boolean matched;
public Students(String name, char gender, Date date, Preference pref ){
this.name = name;
this.gender = gender;
this.birthDay.setYear(date.getYear());
this.birthDay.setMonth(date.getMonth());
this.birthDay.setDay(date.getDay());
this.pref.setQuiet(pref.getQuiet());
this.pref.setMusic(pref.getMusic());
this.pref.setReading(pref.getReading());
this.pref.setChatting(pref.getChatting());
matched = false;
}
public String getName(){
return name;
}
public char getGender(){
return gender;
}
public int compare(Students student){
int score=0;
if (this.getMatch() != true && student.getMatch() != true){
if (student.getGender() != this.gender){
score = 0;
}
else{
score = this.pref.compare(student.pref) + birthDay.compare(student.birthDay);
}
}
return score;
}
public void setMatch(Boolean student){
matched = student;
}
public Boolean getMatch(){
return matched;
}
}