import java.awt.Color;
import java.io.*;

/**
 * A driver that can be used to demonstrate the
 * ColorFinder classes
 */ 
public class Driver
{
    /**
     * The entry point of the application
     *
     * @param args   The command-line arguments (not used)
     */
    public static void main(String[] args)
    {
       BufferedReader   console;
       Color            color;       
       ArrayColorFinder finder;       
       String           name, prompt;

       try
       {
           finder  = new ArrayColorFinder();       
           prompt  = "Enter the name/description of a color: ";
           console = new BufferedReader(new InputStreamReader(System.in));
           
           System.out.println(prompt);
           while ((name = console.readLine()) != null)
           {
               color = finder.getColor(name);
               if (color != null)
               {
                   System.out.println(name + ": " + color + "\n");             
               }
               System.out.println(prompt);
           }
       }
       catch (IOException ioe)
       {
           System.out.println("There was a problem with the I/O. Sorry.");
       }
    }
}
