   import java.io.*;
   import java.util.*;

/***********************************************
 * Checks today's date and prints if today is equal
 *	to input date.
 *
 * @author - Ryan Tighe
 * @version - V1 - January 22, 2007
 * 2:30 - 3:20 PM
 * Lab 4
 ************************************************/
    public class IO_tigherj_Remember
   {
      private static Scanner        dateScanner;
      private static PrintWriter    screen;
    
   /**************************************************
    * Main Method prints the date.
    *	
    *
    *	@param	Command line arguments use File dates
    *	@exception	FileNotFoundException
    **************************************************/  
   
       public static void main(String[] args)
      {
         GregorianCalendar        today;
         String                   name;
         File							  dates;       
      
       
         today    = new GregorianCalendar();
         screen   = new PrintWriter(System.out);
       
         dates 	=	new File(args[0]);
       
         for(int x = 0; x < args.length; x++)
         {
            dates = new File(args[x]);
         
            //prints today's date
            screen.printf(Locale.US, "\nToday's Date: %1$te %1$tB %1$tY\n", today);
            screen.flush();       
         
            try //reads input dates
            {
               dateScanner = new Scanner(dates);			
            }
            catch(FileNotFoundException fnfe) // catches FNFE error
            {
               System.out.println("The File you entered could not be found.");
            }
         
            processDates(today);
         }
      }
    
   
   /**************************************************
    *	proccessDates takes in today's date and prints out
    *	the date if it matches the input.	
    *
    *	@param	today	-	the date of today
    **************************************************/  
       private static void processDates(GregorianCalendar today)
      {
         int           day, month;              
         String        name;
       
      
       // Use the '\t' (tab) and '/' characters as delimiters
         dateScanner.useDelimiter("[\t/]");
          
       // Continues while there are still dates   
         while (dateScanner.hasNext())
         {
            month = dateScanner.nextInt();
            day   = dateScanner.nextInt();
            name  = dateScanner.nextLine();
         //checks for month and day to be equal to today
            if ((month == (today.get(Calendar.MONTH)+1)) && 
              (day   == today.get(Calendar.DAY_OF_MONTH)))
            {
               screen.printf("%s\n", name);
               screen.flush();
            }
         }
      }
    
   
   }
