I am working on an exercise with the following criteria:
"The input consists of pairs of tokens where each pair begins with the type of ticket that the person bought ("coach", "firstclass", or "discount", case-sensitively) and is followed by the number of miles of the flight."
The list can be paired -- coach 1500   firstclass 2000   discount 900   coach 3500 -- and this currently works great. However, when the String and int value are split like so:
firstclass        5000  coach         1500         coach
100 firstclass
2000    discount 300
it breaks entirely. I am almost certain that it has something to do with me using this format (not full)
while(fileScanner.hasNextLine())
{
    StringTokenizer token = new StringTokenizer(fileScanner.nextLine(), " ")
    while(token.hasMoreTokens())
    {
        String ticketClass = token.nextToken().toLowerCase();
        int count = Integer.parseInt(token.nextToken());
        ...
    }
}
because it will always read the first value as a String and the second value as an integer. I am very lost on how to keep track of one or the other while going to read the next line. Any help is truly appreciated.
Similar (I think) problems:
 
    