• + 0 comments

    Java Solution:

    Student(String fname, String lname, int id, int[] score){
            super(fname, lname, id);
            this.testScores = score;
        }
    
        char calculate(){
            int sum = 0;
            for(int i=0; i<testScores.length; i++){
                sum = sum +testScores[i];
            }
            int avg = sum/testScores.length;
            if(avg >= 90){
                return 'O';
            }else if(avg >= 80){
                return 'E';
            }else if(avg >= 70){
                return 'A';
            }else if(avg >= 55){
                return 'P';
            }else if(avg >= 40){
                return 'D';
            }else{
                return 'T';
            }
        }