   import java.io.*;
   import java.util.*;
/*******************************************************************
 * An excersise in using text files in programs
 *
 * Lab 5
 * Lab time: 09/08/08 12:20pm 
 * @version 1.0
 * @author Greg Tamargo (tamarggj@jmu.edu)
 *
 *This work complies with the JMU honor code.
 *
 */

    public class Remember
   {
      private static Scanner        dateScanner;
      private static PrintWriter    screen;
    
   
   
       public static void main(String[] args)
      {
         GregorianCalendar        today;
         String                   name;       
         File                     dates;
         
         today    = new GregorianCalendar();//this finds the value of today's date
         screen   = new PrintWriter(System.out);//this is just like "screen" in Rooter
         
         for(int x=0; x<args.length; x++)//this loop makes it so that more than one file can be processed at a time.
         {
            dates = new File(args[x]);
            
            screen.printf(Locale.US, "\nToday's Date: %1$te %1$tB %1$tY\n", today);//this has to come before the data collected from the file.
            try
            { 
               dateScanner = new Scanner(dates);
            }
                catch (FileNotFoundException e)
               {
               }
                catch (ArrayIndexOutOfBoundsException e)
               {
               }
            screen.flush();//this has to be in the for-loop because it is what puts out the output.
            processDates(today);
         } 
         
      }
    
       private static void processDates(GregorianCalendar today)
      {
         int           day, month;              
         String        name;
       
      
       // Use the '\t' (tab) and '/' characters as delimiters
         dateScanner.useDelimiter("[\t/]");
          
          
         while (dateScanner.hasNext())
         {
            month = dateScanner.nextInt();// these arrange the data into the proper format
            day   = dateScanner.nextInt();
            name  = dateScanner.nextLine();
         
            if ((month == (today.get(Calendar.MONTH)+1)) && //this gets the specific data from the file that has to do with today's date.
              (day   == today.get(Calendar.DAY_OF_MONTH)))
            {
               screen.printf("%s\n", name);
               screen.flush();
            }
         }
      }
    
   
   }
