// BDay.java  v0.03  P. Conrad, for CISC370, 06/07/2007
// Non-OO Menu driven program to process Birthdays
// This version doesn't compile... why?

// This shows several useful techniques, but mostly this is an example
// of how NOT to code in Java... e.g. the use of static methods, not 
// abstracting things into objects, etc.

import java.io.BufferedReader; // for doing input
import java.io.InputStreamReader; // for doing input
import java.io.IOException; // what can occur if something goes wrong

    /**
     * BDay is a class holding a non-OO main program that 
     * provides a menu of options for manipulating birthdays.
     * This version is a work in progress.
     */

class BDay {
    
    // Declare a variable stdin that we can use for input.
    // See http://www.cs.wisc.edu/~cs302/io/JavaIO.html#consoleIN
    // for an explanation of this bit of code
    
    private static BufferedReader stdin = 
	new BufferedReader(new InputStreamReader( System.in ) );
    
    /**
     * The main program is responsible for implementing the menu
     */

    public static void main(String args[]) throws IOException {
	
	// Welcome the user
	
	System.out.println("Welcome to the Birthday Program");
	
	// Print a menu of options, and prompt for input
	
	printMenu();
	System.out.print("Please enter an option: ");
	
	String answer =  stdin.readLine();
	
	while (!answer.equals("q")) {
	    
	    if (answer.equals("f")) 
		{
		    findPersonsBirthday();
		} 
	    else if (answer.equals("w"))
		{
		    whosBirthdayIsOnThisDate();
		}
	    else if (answer.equals("c"))
		{
		    compareTwoBirthdays();
		}
	    else 
		{
		    System.out.println("You entered: " + answer);
		    System.out.println(" I don't understand that option.");
		}
	printMenu();
	System.out.print("Please enter an option: ");
	answer = stdin.readLine();
	    
	} // while
	
	
    } // main
    
    /**
     * printMenu prints the menu of options for the user
     */

    public static void printMenu() {
	System.out.println(" Menu of options ");
	System.out.println(" =============== ");
	System.out.println(" f  find a person's birthday");
	System.out.println(" w  who has a birthday on a certain date");
	System.out.println(" c  compare two people's ages");
	System.out.println(" q  quit   ");
	System.out.println("");	
    }


    void findPersonsBirthday() {
	System.out.println("Find a person's birthday...");
    }

    void whosBirthdayIsOnThisDate()
    {
	System.out.println("Who's birthday is on this date...");
    }
    
    void compareTwoBirthdays() {
	System.out.println("Compare two birthdays...");
    }



}
