import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

// https://www.hackerrank.com/challenges/angry-professor/problem
public class AngryProfessor {

    private static final String SPACE = " ";

    enum Answer {
        YES, NO
    }

    private class Case {

        private final int totalStudents;
        private final int minStudentsOnTime;
        private final int[] arrivals;

        public Case(int totalStudents, int minStudentsOnTime, int[] arrivals) {
            this.totalStudents = totalStudents;
            this.minStudentsOnTime = minStudentsOnTime;
            this.arrivals = arrivals;
        }

        public int getTotalStudents() {
            return totalStudents;
        }

        public int getMinStudentsOnTime() {
            return minStudentsOnTime;
        }

        public int[] getArrivals() {
            return arrivals;
        }
    }

    private void validate(Case aCase) {
        int totalStudents = aCase.getTotalStudents();
        int[] arrivals = aCase.getArrivals();
        if (totalStudents != arrivals.length) {
            String errorMessage = String.format("Total students expected to be %s, but is %s",
                totalStudents, arrivals.length);
            throw new AssertionError(errorMessage);
        }
    }

    private int countEarly(Case aCase) {
        int studentsOnTime = 0;
        for (int arrival : aCase.getArrivals()) {
            studentsOnTime += (arrival <= 0) ? 1 : 0;
        }
        return studentsOnTime;
    }

    private Answer isClassCancelled(Case aCase) {
        int studentsOnTime = countEarly(aCase);
        return (studentsOnTime >= aCase.getMinStudentsOnTime()) ? Answer.NO : Answer.YES;
    }

    private Case readCase(BufferedReader reader) throws IOException {
        String[] split = reader.readLine().split(SPACE);
        int totalStudents = Integer.parseInt(split[0]);
        int minStudentsOnTime = Integer.parseInt(split[1]);
        String[] arrivalsStr = reader.readLine().split(SPACE);
        int[] arrivals = Arrays.stream(arrivalsStr).mapToInt(Integer::parseInt).toArray();
        return new Case(totalStudents, minStudentsOnTime, arrivals);
    }

    private List<Answer> solve() throws IOException {
        List<Answer> answers = new ArrayList<>();
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int totalCases = Integer.parseInt(reader.readLine());
            for (int i = 0; i < totalCases; i++) {
                Case aCase = readCase(reader);
                validate(aCase);
                answers.add(isClassCancelled(aCase));
            }
        }
        return answers;
    }

    public static void main(String[] args) throws IOException {
        AngryProfessor angryProfessor = new AngryProfessor();
        List<Answer> answers = angryProfessor.solve();
        for (Answer answer : answers) {
            System.out.println(answer);
        }
    }
}

@@ -738,265 +738,8 @@
     
-    public int getTotalStudents() %7B%0A            return totalStudents;%0A        %7D%0A%0A        public int getMinStudentsOnTime() %7B%0A            return minStudentsOnTime;%0A        %7D%0A%0A        public int%5B%5D getArrivals() %7B%0A            return arrivals;%0A        %7D%0A    %7D%0A%0A
     
@@ -760,34 +760,24 @@
 alidate(
-Case aCase
 ) %7B%0A    
     int 
@@ -772,104 +772,8 @@
     
-    int totalStudents = aCase.getTotalStudents();%0A        int%5B%5D arrivals = aCase.getArrivals();%0A
     
@@ -812,24 +812,28 @@
 s.length) %7B%0A
+    
             
@@ -931,16 +931,20 @@
         
+ 
+   
 totalStu
@@ -968,16 +968,20 @@
 ength);%0A
+    
         
@@ -1036,17 +1036,29 @@
     
+   
+ 
 %7D%0A
+    
     %7D%0A%0A
+    
     
@@ -1080,30 +1080,24 @@
 ntEarly(
-Case aCase
 ) %7B%0A
+    
         
@@ -1116,24 +1116,28 @@
 OnTime = 0;%0A
+    
         for 
@@ -1156,30 +1156,23 @@
  : a
-Case.getA
 rrivals
-()
 ) %7B%0A
+    
     
@@ -1221,34 +1221,42 @@
  1 : 0;%0A        
+   
+ 
 %7D%0A
+    
         return s
@@ -1270,23 +1270,31 @@
 OnTime;%0A
+    
     %7D%0A%0A
+    
     priv
@@ -1325,22 +1325,16 @@
 led(
-Case aCase
 ) %7B%0A
+    
     
@@ -1369,24 +1369,23 @@
 ntEarly(
-aCase);%0A
+);%0A    
         
@@ -1414,18 +1414,9 @@
  %3E= 
-aCase.getM
+m
 inSt
@@ -1427,18 +1427,16 @@
 tsOnTime
-()
 ) ? Answ
@@ -1455,16 +1455,132 @@
 er.YES;%0A
+        %7D%0A%0A        public Answer solve() %7B%0A            validate();%0A            return isClassCancelled();%0A        %7D%0A
     %7D%0A%0A 
@@ -2432,75 +2432,32 @@
     
-validate(aCase);%0A                answers.add(isClassCancelled(aCase
+answers.add(aCase.solve(
 ));%0A

Solve problem in a more object-oriented way