<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import java.io.*;
import javax.swing.*;
import java.util.*;

/** Contains only static methods */
public class Methods {
    
    /** either null or the last directory that a JFileChooser looked at
       using function getFile */
    private static File lastDirectory= null;
    
    /** = a file name from user using JFileChooser using the last directory looked at.
          Makes use of private static variable lastDirectory */
    public static File getFile()  {
        JFileChooser jd;
        
        if (lastDirectory==null)
             { jd= new JFileChooser();}
        else { jd= new JFileChooser(lastDirectory); }
        
        jd.setDialogTitle("Choose input file");
        jd.showOpenDialog(null);
        
        if (jd.getSelectedFile()==null)
            return null;
        lastDirectory= jd.getSelectedFile().getParentFile();
        return jd.getSelectedFile();
    }
    
    /** Obtain a file name from the user using JFileChooser and return a reader
        that is linked to it. Return null if the user does not select a file.
        A BufferedReader has a method readLine() that
        reads the next line and yields it as a String */
    public static BufferedReader getReader() throws IOException {
        File file= getFile();
        if (file==null)
            return null;
        
        FileReader fr= new FileReader(file);
        return new BufferedReader(fr);
    }
    
    /** = s, but padded with blanks or shortened to n characters.
          precondition: 1 &lt;= n &lt;= 20 */
    public static String fixLength(String s, int n) {
        return (s + "                    ").substring(0,n);
    }
       
   /** = a copy of Vector v[0..v.size()-1] */
   public static Vector copy(Vector v) {
      // WRITE THE METHOD BODY
      return null;
   }
   
   /** = a Vector of Games of v[0..v.size()-1]with those by person p removed */
   public static Vector copy(Vector v, String p) {
       Vector v1= new Vector();
       // YOU FILL IN THE CODE HERE
       
       
       return v1;
   }
   
   /** = a Vector of all Games of v[0..v.size()-1] with a total score &gt;= n */
   public static Vector copy(Vector v, int n) {
       Vector v1= new Vector();
       // YOU FILL IN THE CODE HERE
       
       return v1;
   }
   
   /** Given h &lt;= k, return the position of the minimum value of v[h..k]
      The elements of v are of class Game.
      If whichMin=0, use person's name and alphabetical order in determining minimum.
      If whichMin=1, use person's name and reverse alphaebtical order determining minimum.
      If whichMin=2, use total score in determining the minimum.
      If whichMin=3, use -(total score) in determining the minimum,
      For example, total score 30 is less than total score 25.*/
   public static int min(Vector v, int h, int k, int whichMin) {
      // YOU WRITE THE FUNCTION BODY
      return 0;
   }
   
   /** Put v[0..v.size()-1] in ascending order. It elements are of class Game.
       If kind=0, sort on person's name playing the game.
       if kind=1, sort on person's name but in reverse of alphabetical order
       if kind=2, sort on total score 
       if kind=3, sort on -(total score) (e.g 30 is smaller than 25)*/
   public static void selectionSort(Vector v, int kind) {
       // YOU WRITE THE PROCEDURE BODY
   }

}</pre></body></html>