Grading Students

  • + 0 comments
    public static List<Integer> gradingStudents(List<Integer> grades) {
        // Write your code here
        List<Integer> newGrades = new ArrayList<Integer>();
        int students = grades.size();
        for(int i=0 ; i<students;i++){
            int factor = (grades.get(i)/5) + 1;
            if(grades.get(i)<38){
                newGrades.add(grades.get(i));
            }
            else if(factor*5 - grades.get(i) < 3){
                newGrades.add(factor*5);
            }
            else{
                newGrades.add(grades.get(i));
            }
        }
        return newGrades;
    
        }