When do you call a sorting and filtering method for a client class for a billboard project that sorts and filters from a txt file?
<p>I am working on a project that sorts and filters the year, artist, title, rank from a Billboards top txt file. I had already made a class that filters and sorts the year, rank, artist, title correctly. All i need to do is when do i call those methods in my client program . So Im trying to make it so that i can type the rank, artist, title, or year and then it will find any song that matches any of those criterias and will print those songs out. </p>

<p>When do you call the sorting and filtering methods and with what parameters in the client program</p>

<p>this is my code that i Have for my client program so far. If you still dont get it please ask and i can show you my other methods to make this more clear.</p>

<pre><code>import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.Scanner;


public class SongClient {
    public static void main(String[] args) throws FileNotFoundException {
        Song [] numsongs = new Song[37000];

        // Find the input and output files based on the arguments passed
        Scanner file = new Scanner(new File(findArg(args, "-input")));
        File outFile = new File(findArg(args, "-output"));


        PrintStream output = new PrintStream(outFile);

        // Read each line of the input file, and print a line of output
        //  greeting that person
        int i = 0;
        while (file.hasNextLine()) {
            String name = file.nextLine();
            Song blank = Song.parse(name);
            numsongs[i] = blank;  
            i++;
        }
        SongCollection totalsongs = new SongCollection(numsongs);
        output.println(totalsongs);
    }

    // Finds the command line argument with the given tag
    //   and return its associated value
    // Assumes command line arguments are passed in the form
    //   -&lt;tag&gt;:&lt;value&gt;
    public static String findArg(String[] args, String tag) {
        for (int i = 0; i &lt; args.length; i++) {
            Scanner tokens = new Scanner(args[i]);
            tokens.useDelimiter(":");

            String myTag = tokens.next();
            String value = tokens.next();
            if (tag.equalsIgnoreCase(myTag)) {
                return value;
            }
        }

        return null;
    }
}
</code></pre>
