-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
72 lines (56 loc) · 1.61 KB
/
Student.java
File metadata and controls
72 lines (56 loc) · 1.61 KB
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
package data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class Student {
private final Map<String, Double> notesMap;
private final String identifier;
private final String name;
private final String surname;
private final Program program;
public Student(String identifier, String name, String surname, Program program) {
this.identifier = identifier;
this.name = name;
this.surname = surname;
this.program = program;
this.notesMap = new HashMap<>();
}
public double moyenne() {
double res = 0;
int div = 0;
for (BlocInterface bloc : program.getBlocs()) {
for (Course course : bloc.getBlocCourses()) {
if (!(notesMap.get(course.getID()) == null)) {
res += notesMap.get(course.getID()) * course.getCredit();
div += course.getCredit();
}
}
}
return res / div;
}
public double getNoteCours(String cours) {
return notesMap.get(cours);
}
public Map<String, Double> getNotesMap() {
return notesMap;
}
public Program getProgram() {
return program;
}
public String getProgramID() {
return program.getProgramID();
}
public String getIdentifier() {
return identifier;
}
public String getName() {
return name;
}
public String getSurname() {
return surname;
}
public String toString()
{
return String.format("\"%s\",\"%s\",\"%s\" ", identifier, name, surname);
}
}