import java.io.*;
import java.util.*;
/******************************************
 * Takes input from a command line argument and finds the date
 * on the Gregorian Calandar.
 *
 * @author - Andrew Smith - modified from Adams
 * @date - 1/22/07
 ********************************************/

public class IO_smith3at_Remember
{
	private static Scanner        dateScanner;
	private static PrintWriter    screen;

	public static void main(String args[])
	{
		GregorianCalendar        today;
		String                   name;
		File                     dates;
		int index;

		index = args.length;
		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();

		try
		{
			for(int x = 0; x < index; x++)
			{
				dates = new File (args[x]);
				dateScanner = new Scanner(dates);
				processDates(today);
			}
		}
		catch(FileNotFoundException fnfe)
		{
			System.out.println(fnfe.getMessage());
		}
	}


	/*****************************************
	* Changes the date to the Gregorian Calandar
	*
	* @param - today - gets the date in teh Gregorian Calandar
	*
	******************************************/
	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();
			}
		}
	}
}
