-
Notifications
You must be signed in to change notification settings - Fork 1
/
Student.java
53 lines (40 loc) · 1008 Bytes
/
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
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Student {
private String name;
private String id;
private final List<Course> courses = new ArrayList<>();
private final Map<Course, Integer> grades = new HashMap<>();
public Student() {
}
public Student(String name, String id) {
this.name = name;
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List<Course> getCourses() {
return courses;
}
public void addCourse(Course course) {
this.courses.add(course);
}
public void setGrade(Course course, int grade) {
this.grades.put(course, grade);
}
public Map<Course, Integer> getGrades() {
return grades;
}
}