   import java.io.*;
   import java.util.*;
/********************************************************************
* This method prints out information corresponding to todays date.
*
* @author: Jonathan Herman
* @version: v2
********************************************************************/
// Elizabeth Adams
// Date: 1/12/07
// Lab: 4
// Section: 2

    public class IO_hermanjl_Remember
   {
      private static Scanner        dateScanner;
      private static PrintWriter    screen;
   	   
      /**
      *This method prints out information held in the specified files
		*corresponding to todays date.
      *
      *@param args command line arguments-unused
      */
       public static void main(String[] args)
      {
         GregorianCalendar        today;
         String                   name;        
         File                     dates;
				
         today    = new GregorianCalendar();     // creates a GC object for today
         screen   = new PrintWriter(System.out); // used to display ouput
      
         // prints out todays date in mm/dd/yy format
         screen.printf(Locale.US, "\nToday's Date: %1$te %1$tB %1$tY\n", today);
         screen.flush(); // clears screen    
      	
			// prints out the information found in these files with processDates()
			for (int x = 0; x < args.length; x++) // executes loop for each file given
			{				
				// attempts to assign the next argument to dateScanner
				try
				{
				   dates = new File (args[x]); 
	            dateScanner = new Scanner(dates); // assigns dates to input    
	         }
				   catch(FileNotFoundException fnfe) // catches if the file does not exist
					{
					   System.out.println("No file was found."); // tells the user what happened
				   }
				
				// prints out the date and its corresponding elements in the file
         	processDates(today);
			}
      }
    
   
     
      /**
      *This method outputs information in a file based on the date given.
      *
      *@param today GregorianCalendar with todays information
      */
       private static void processDates(GregorianCalendar today)
      {
         int           day, month;              
         String        name;      
      
         // Use the '\t' (tab) and '/' characters as delimiters
         dateScanner.useDelimiter("[\t/]");          
          
			// finds and prints information corresponding with todays date
         while (dateScanner.hasNext()) // until the file is over
         {
            month = dateScanner.nextInt();
            day   = dateScanner.nextInt();
            name  = dateScanner.nextLine();
         
				// checks to see if the next string corresponds to todays date
            if ((month == (today.get(Calendar.MONTH)+1)) && 
              (day   == today.get(Calendar.DAY_OF_MONTH)))
            {
					// prints out the line
               screen.printf("%s\n", name);
               screen.flush();
            }
         }
      }
    
   
   }
