   import java.io.*;//import io package
   import java.util.*;
/**============================================================== 
 * Computing often involves the need to process input from a file 
 * and output data to a file. This lab will provide practice in reading 
 * from and writing to files.
 * This part of the lab will give you more experience working with file input.
 * @author  Toufic Arabi 
 * @version 1 
 * 
//==============================================================  */
// Date:  01/22/2007
// Section 3
// Lab 4

    public class IO_arabitm_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);
      
         screen.printf(Locale.US, "\nToday's Date: %1$te %1$tB %1$tY\n", today);
         screen.flush();       
      
      	// try catch block to check if the files exists
         try
         {
         	//process multiple files when their names are passed-in 
         	//as command-line arguments.
            for (int count = 0; count < args.length; count++)
            {
               dates = new File (args[count]);
               dateScanner = new Scanner(dates);
             	//calls on the processDates method and passes today as an argument  
            	processDates(today);
            }
         	
         }
         
             catch (FileNotFoundException fnfe) 
            {
               System.out.print("The file that was passed is not found " +
                  		fnfe.getMessage() + "\n");	
            }
       
        
        
         
      }//end main
    
   
   
       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();
            }
         }
      }
    
   
   }//end class
