-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day_12.java
33 lines (29 loc) · 810 Bytes
/
Day_12.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
class Student extends Person{
private int[] testScores;
Student( String firstName, String lastName, int identification, int testScore[] )
{
super(firstName,lastName,identification);
this.testScores = testScore;
}
char calculate()
{
int sum=0;
for( int i=0; i<testScores.length; i++ ){
sum+=testScores[i];
}
int avg = sum/testScores.length;
if( avg>=90 && avg<=100 )
return 'O';
else if( avg>=80 && avg<90 )
return 'E';
else if( avg>=70 && avg<80 )
return 'A';
else if( avg>=55 && avg<70 )
return 'P';
else if( avg>=40 && avg<55 )
return 'D';
else if( avg<40 )
return 'T';
return ' ';
}
}