import java.io.*;
import java.util.*;


	/*************************************************************
	* This program will take in a .txt document and compare it with todays
	* date, giving reminders for things that need to be remembered or done
	*
	* @author-Mike Ellis
	* @Version- V1 1/22/07
		**************************************************************
		* References and Acknowledgements- I Recieved no outside help with this Program
		**************************************************************/
	// Mike Ellis
	// 2:30 Lab
	// 1/10/07
	// Lab-2

public class IO_ellisms_Remember
{
    private static Scanner        dateScanner;
    private static PrintWriter    screen;
    


    public static void main(String[] args) throws FileNotFoundException
    {
       GregorianCalendar        today;
       String                   name;       
		 File                     dates;
       int                      counter;
		 
       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();       

       		 
		 if (args.length>=1)
		 {
		 	for(counter=0; counter<args.length; counter++)
			{
		 	dates=new File(args[counter]);
			dateScanner=new Scanner(dates);
			processDates(today);
			}
			
		 }
		else
		{
		  dateScanner = new Scanner(System.in);
        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();
          }
       }
    }
    

}
