import java.util.*;

public class Verifier
{
    public static final String EXAMPLE_DATA = "example.txt";

    public static final Ticket OWN_TICKET = new Ticket(new String[] { "7" ,"1" ,"14" });
    public static final Ticket TICKET_1 = new Ticket(new String[] { "40" ,"4" ,"50" });
    public static final Ticket TICKET_2 = new Ticket(new String[] { "55" ,"2" ,"20" });
    public static final Ticket TICKET_3 = new Ticket(new String[] { "38" ,"6" ,"12" });

    public Verifier (boolean debug)
    {
        _debug = debug;
    }

    public boolean verify ()
    {
        Vector<Category> cats = Util.loadCategories(EXAMPLE_DATA, _debug);
        Vector<Ticket> ticks = Util.loadTickets(EXAMPLE_DATA, _debug);

        if (_debug)
        {
            for (int i = 0; i < cats.size(); i++)
                System.out.println(cats.elementAt(i));

            for (int j = 0; j < ticks.size(); j++)
                System.out.println(ticks.elementAt(j));
        }

        boolean[] correct = new boolean[4];

        for (int l = 0; l < 4; l++)
            correct[l] = false;

        for (int k = 0; k < ticks.size(); k++)
        {
            if (ticks.elementAt(k).equals(OWN_TICKET) && (Util.checkAlCategories(cats, OWN_TICKET)))
                correct[0] = true;

            if (ticks.elementAt(k).equals(TICKET_1) && (!Util.checkAlCategories(cats, TICKET_1)))
                correct[1] = true;

            if (ticks.elementAt(k).equals(TICKET_2) && (!Util.checkAlCategories(cats, TICKET_2)))
                correct[2] = true;

            if (ticks.elementAt(k).equals(TICKET_3) && (!Util.checkAlCategories(cats, TICKET_3)))
                correct[3] = true;
        }

        return correct[0] & correct[1] & correct[2] & correct[3];
    }

    private boolean _debug;
}
@@ -450,24 +450,78 @@
  ,%2212%22 %7D);%0A%0A
+    public static final int EXAMPLE_ERROR_RATE = 71;%0A%0A
     public V
@@ -1029,42 +1029,25 @@
     
-boolean%5B%5D correct = new boolean%5B4%5D
+int errorRate = 0
 ;%0A%0A 
@@ -1066,23 +1066,34 @@
 int 
-l
+k
  = 0; 
-l %3C 4; l
+k %3C ticks.size(); k
 ++)%0A
@@ -1104,89 +1104,66 @@
     
+%7B%0A
     
-correct%5Bl%5D = false;%0A%0A        for (int k = 0; k %3C ticks.size(); k++)%0A        %7B
+        int%5B%5D values = null;%0A            int index;%0A
 %0A   
@@ -1212,21 +1212,57 @@
 _TICKET)
- && (
+)%0A            %7B%0A                values = 
 Util.che
@@ -1293,18 +1293,18 @@
 _TICKET)
-))
+;%0A
 %0A       
@@ -1316,26 +1316,219 @@
     
-correct%5B0
+for (index = 0; index %3C values.length; index++)%0A                %7B%0A                    if (values%5Bindex
 %5D 
+!
 = 
-true;
+Util.CHECKED_NUMBER)%0A                        errorRate += values%5Bindex%5D;%0A                %7D%0A            %7D
 %0A%0A  
@@ -1576,22 +1576,57 @@
 ICKET_1)
- && (!
+)%0A            %7B%0A                values = 
 Util.che
@@ -1655,18 +1655,18 @@
 ICKET_1)
-))
+;%0A
 %0A       
@@ -1678,26 +1678,219 @@
     
-correct%5B1
+for (index = 0; index %3C values.length; index++)%0A                %7B%0A                    if (values%5Bindex
 %5D 
+!
 = 
-true;
+Util.CHECKED_NUMBER)%0A                        errorRate += values%5Bindex%5D;%0A                %7D%0A            %7D
 %0A%0A  
@@ -1938,22 +1938,57 @@
 ICKET_2)
- && (!
+)%0A            %7B%0A                values = 
 Util.che
@@ -2017,18 +2017,18 @@
 ICKET_2)
-))
+;%0A
 %0A       
@@ -2040,26 +2040,219 @@
     
-correct%5B2
+for (index = 0; index %3C values.length; index++)%0A                %7B%0A                    if (values%5Bindex
 %5D 
+!
 = 
-true;
+Util.CHECKED_NUMBER)%0A                        errorRate += values%5Bindex%5D;%0A                %7D%0A            %7D
 %0A%0A  
@@ -2304,14 +2304,49 @@
 T_3)
- && (!
+)%0A            %7B%0A                values = 
 Util
@@ -2379,18 +2379,18 @@
 ICKET_3)
-))
+;%0A
 %0A       
@@ -2402,102 +2402,279 @@
     
-correct%5B3
+for (index = 0; index %3C values.length; index++)%0A                %7B%0A                    if (values%5Bindex
 %5D 
+!
 = 
-true;%0A        %7D%0A%0A        return correct%5B0%5D & correct%5B1%5D & correct%5B2%5D & correct%5B3%5D
+Util.CHECKED_NUMBER)%0A                        errorRate += values%5Bindex%5D;%0A                %7D%0A            %7D%0A        %7D%0A%0A        return (errorRate == EXAMPLE_ERROR_RATE)
 ;%0A  

Update Verifier.java