Grading Students

  • + 0 comments
    public static List<Integer> gradingStudents(List<Integer> grades) {
    // Write your code here
    List<Integer> finalList = new ArrayList<>();
        for(Integer num :grades){
            if(num < 38){
                finalList.add(num);
            }else if(num % 5 == 0 || num % 5 == 1 || num % 5 == 2){
                finalList.add(num);
            }else if (num % 5 == 3){
                  finalList.add(num + 2);
            }else if (num % 5 == 4){
                  finalList.add(num + 1);
            }
        }
     return finalList;
    }