I have a java program that is scanning a text file with the following information:


Advanced Martial Arts Diploma

(Burbanks Ninja School)

Adkins, Scott 72

Black, Jack 44

Carradine, David 81

Chan, Jackie 75

Chow, Stephen 77

Chow, Yung-Fat 79

Jaa, Tony 71

Lee, Bruce 76

Li, Jet 76

Norris, Chuck 71

Oedekerk, Steve 58

Reeves, Keanu 62

Uwais, Iko 75

Yen, Donnie 80

Yeoh, Michelle 79

Zhang, Ziyi 75



Pilot (Starfleet Academy)

Archer, Jonathan 71

Janeway, Kathryn 74

Kirk, James T. 79

Picard, Jean-Luc 85

Pike, Christopher 80

Riker, William 79



Advanced Action Heroes (Disney U)

Aladdin 91

Benedict, Julius 45

Brewer, Gordy 82

Conan 60

Duck, Donald 40

Iincredible, Mr. 85

Matrix, John 64

Mouse, Mickey 51

Owens, Ray 82

Poppins, Mary 85

Quaid, Douglas 75

Richards, Ben 68

Simba 80

Slater, Jack 80

Terminator, The 90

Tully, Louis DNF



Attire, Poise & Grace



Bieber, Justin 33

Bullock, Sandra 80

Ciccone, Madonna 60

Cyrus, Miley 40

Gaga, Lady 50

Lauper, Cindi 55

Minaj, Nicki 45

Sarkisian, Cher 75




That's All, Folks!

Here is my code so far to scan the text file and return the formatted values:

Code:
    public static void main(String[] args) throws Exception {
        Scanner fileScanner = new Scanner(new File("lists.txt"));
        String line = fileScanner.nextLine().trim();

        String programName;
        String schoolName;
        String topStudent;
        int topGrade;



        while (!line.equals("That's All, Folks!")) {
            //extract a program's information
            System.out.println("");
            System.out.println(line.trim());
            line = fileScanner.nextLine().trim();
            line = line.replaceAll("\\s+", " ");
            System.out.println("");
            while (!line.isEmpty()) {
    
                //deal with one student                
                System.out.println(line);
                line = fileScanner.nextLine().trim();
                line = line.replaceAll("\\s+", " ");
            }
            //displays summary information for a program    
            line = fileScanner.nextLine().trim();
        }
    }
I'm supposed to check these strings (some have one, and some have two names. One has a DNF instead of a grade). How would I go about only returning the name and top grade of each person in each program to look like below:

Advanced Martial Arts Diploma
(Burbanks Ninja School)
David Carradine

Pilot
(Starfleet Academy)
Jean-Luc Picard

Advanced Action Heroes
Disney U)
Aladdin

Attire, Poise & Grace
Sandra Bullock

______________________

This is where I'm absolutely stuck. I know that I'm probably supposed to parse the int value from the strings and compare them with an if statement, but I do not know how to code that. I need to also take into account the one DNF grade. Please help!