// BdayTDD1.java  P. Conrad 06/07/07
// A simple TDD program to show how we might start the birthday problem
// We are starting with Ben's suggestion of a simple function
// that takes two strings and returns a string.

class BdayTDD1 {

    public static void main(String args[]) {
	
	String bday_Phill = "07/02/1964";

	String bday_TomCruise = "07/03/1962";

	String expectedAnswer = "2 yrs 0 mos 1 days younger";
	

	String actualAnswer = birthdayDiff(bday_Phill,bday_TomCruise);

	System.out.println("actualAnswer=" + actualAnswer);

	if (actualAnswer.equals(expectedAnswer)) 
	    System.out.println("Passed!");
	else
	    System.out.println("Failed!");

    }

    /**
     * birthdayDiff returns a string indicating that the first date
     * 
     */


    public static void splitDate(String inputDate,
				 Integer year,
				 Integer month,
				 Integer day)
    {
	String pieces[] = inputDate.split("/");
	year = Integer.parseInt(pieces[2]);
	month = Integer.parseInt(pieces[0]);
	day = Integer.parseInt(pieces[1]);
    }

    public static String birthdayDiff(String firstBday,
				      String secondBday)
    {
	String fpieces[] =  firstBday.split("/");

	int fyear = Integer.parseInt(fpieces[2]); 
	int fmonth = Integer.parseInt(fpieces[0]); 
        int fday = Integer.parseInt(fpieces[1]); 
	
	System.out.println("fyear = " + fyear );
	System.out.println("fmonth = " + fmonth );
	System.out.println("fday = " + fday );

	Integer syear,smonth,sday;

	splitDate(secondBday,syear,smonth,sday);

	System.out.println("fyear = " + fyear );
	System.out.println("fmonth = " + fmonth );
	System.out.println("fday = " + fday );


    }

}
