   import java.io.*;
   import java.util.*;
/***********************************************
 * Lab 3 - IO
 *
 * @author -Ben Hein
 * @version - V1 - Jan 22, 2007
 * Section: 1
 ************************************************/
 /*
 /  References and Ackknowledgements: I have recieved
 /  no help on this programming assignment
 /
 /***********************************************/

    public class IO_heinbr_Remember
   {
   
   /******
   This class reads in files and prints results according to todays date.
   
   ******/
      private static Scanner        dateScanner;
      private static PrintWriter    screen;
    
   
   
       public static void main(String[] args)
      {
         GregorianCalendar        today;
         String                   name;       
         File	dates;
			
			//initializes dates
         dates = new File(args[0]);
			
			//takes as many files as the user inputs
         for(int index = 1; index < args.length; index++)
            dates =new File( args[index]);
       
         today    = new GregorianCalendar();
         screen   = new PrintWriter(System.out);
      
         screen.printf(Locale.US, "\nToday's Date: %1$te %1$tB %1$tY\n", today);
         screen.flush();  
          
			 //handles File Not Found Exceptions  
         try
         {
            dateScanner = new Scanner(dates);
         }
         
             catch(java.io.FileNotFoundException fnfe)
            {
               System.out.println("File not found exception.");
               System.exit(0);
            }
      
         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();
            day   = dateScanner.nextInt();
            name  = dateScanner.nextLine();
         
            if ((month == (today.get(Calendar.MONTH)+1)) && 
              (day   == today.get(Calendar.DAY_OF_MONTH)))
            {
               screen.printf("%s\n", name);
               screen.flush();
            }
         }
      }
    
   
   }
