• + 0 comments

    Java Solution

    class Student extends Person{
    	private int[] testScores;
        
        Student(String firstName, String lastName, int id, int[] scores){
            super(firstName, lastName, id);
            this.testScores = scores;
        }
    
        char calculate() {
            int myScore = 0;
            for(int i : testScores) myScore += i;
            myScore /= testScores.length;
    
            char myResult = (
              (myScore>=90)?'O':
              (myScore>=80)?'E':
              (myScore>=70)?'A':
              (myScore>=55)?'P':
              (myScore>=40)?'D':
              'T'
            );
            
            return(myResult);
        }
        
    }