blob: cc9938c42088bdb12e7a56037b649c7123b4b271 (
plain)
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
|
public class Student extends Person implements Uniperson {
// Yes, we do support very long educations
private long semester;
private String degree;
private double GPA;
private int GPAcount;
public Student(String name, short age, String gender, long semester, String degree) {
super(name, gender, age);
this.semester = semester;
this.degree = degree;
this.GPA = 0;
this.GPAcount = 0;
}
public void addGPA(double GPA) {
this.GPA += GPA;
this.GPAcount++;
}
public long getSem() {
return this.semester;
}
public String getDeg() {
return this.degree;
}
public double avgGPA() {
if (this.GPAcount == 0) {
return 0;
}
return this.GPA / this.GPAcount;
}
}
|