-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDay12.java
35 lines (32 loc) · 909 Bytes
/
Day12.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
class Student extends Person {
private int[] testScores;
Student(String firstName, String lastName, int identification, int[] scores){
super(firstName, lastName, identification);
this.testScores = scores;
}
public char calculate() {
int average = 0;
for(int i = 0; i < testScores.length; i++){
average += testScores[i];
}
average = average / testScores.length;
if(average >= 90) {
return 'O'; // Outstanding
}
else if(average >= 80) {
return 'E'; // Exceeds Expectations
}
else if(average >= 70) {
return 'A'; // Acceptable
}
else if(average >= 55) {
return 'P'; // Poor
}
else if(average >= 40) {
return 'D'; // Dreadful
}
else {
return 'T'; // Troll
}
}
}