You are viewing a single comment's thread. Return to all comments →
public static List gradingStudents(List grades) { // Write your code here List newList = new ArrayList<>(); for(Integer x : grades){ if(x >= 38){ // case (x)0 -> (x)4 if(x%10 < 5 ){ if( 5 - (x%10) < 3) x = x + (5 - (x%10)); } //case (x)5 -> (x)9 else{ if( 5 - (x%10) <= -3 && 5 - (x%10) != 0 ) x = x + (5 - (x%10) + 5); } } newList.add(x); } return newList;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Grading Students
You are viewing a single comment's thread. Return to all comments →
public static List gradingStudents(List grades) { // Write your code here List newList = new ArrayList<>(); for(Integer x : grades){ if(x >= 38){ // case (x)0 -> (x)4 if(x%10 < 5 ){ if( 5 - (x%10) < 3) x = x + (5 - (x%10)); } //case (x)5 -> (x)9 else{ if( 5 - (x%10) <= -3 && 5 - (x%10) != 0 ) x = x + (5 - (x%10) + 5); } } newList.add(x); } return newList;