import java.io.*;
import java.util.*;
/***********************************************
 * This class outputs the date, and if anything from
 * the file has the same date.
 *
 * @author - Lauren Jones
 * @version - V1 - 1.22.07
 ************************************************/
 /*
 /  References and Ackknowledgements: I have recieved
 /  no help on this programming assignment
 /
 /***********************************************/
public class IO_joneslj_Remember
{
    private static Scanner        dateScanner;
    private static PrintWriter    screen;
    


    public static void main(String[] args)
    {
       GregorianCalendar        today;
       String                   name; 
		 File							  dates;      

       
       today    = new GregorianCalendar();
       screen   = new PrintWriter(System.out);
		 
		 for(int index = 0; index < args.length; index++)
			{
		  		dates  = new File(args[index]); //takes in filename and assigns it to dates

       		screen.printf(Locale.US, "\nToday's Date: %1$te %1$tB %1$tY\n", today); //prints today's date
       		screen.flush();       

      		 try
		 		{
		 			dateScanner = new Scanner(dates); //uses file as input
		 		}
		
				catch(FileNotFoundException fnfe) //handles in case file is not found
				{
					System.out.println("File Not Found.");
				}

       		processDates(today); //runs today's date through the file
			}
    }
    


    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); //prints events of the same date from file
             screen.flush();
          }
       }
    }
    

}
