   import java.io.*;
   import java.util.*;
/**
 * Remember
 *
/**
 *@authur Professor Elizabeth S. Adams
 * Yoshihiro Fujio
 * CS239 Section 2
 * Lab - Experimenting with File I/O
 * V1 2007/1/22
**/


    public class IO_fujioyx_Remember
   {
      private static Scanner        dateScanner;
      private static PrintWriter    screen;
    
   
   
       public static void main(String[] args)
      {
         GregorianCalendar        today; // getting dates from Gregorian Calendar
         String                   name;  // name of birthday person   
         File							  dates; // File
         
      
       
         today    = new GregorianCalendar(); // call GregorianCalendar
         screen   = new PrintWriter(System.out); // call PrintWriter
      
         screen.printf(Locale.US, "\nToday's Date: %1$te %1$tB %1$tY\n", today); // getting today's date by date( %1$te), month(%1$tB), and year(%1$tY)
         screen.flush(); // flush the stream 
       
         for (int ii = 0; ii < args.length; ii++)
         {
            dates 	 = new File(args[ii]); // get command-line argument
            try     
            {
               dateScanner = new Scanner(dates); // call dateScanner
            }
            
                catch (FileNotFoundException fnfe) // exception came out so use try catch to avoid error
               {
                  System.out.println("no excpected file found");
               }
         
            processDates(today); // jump to processDates with imfomation of today's date
         }
      }
    
   
   
       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 main
    
   
   } // end class
