001package edu.pdx.cs410J.family;
002
003import java.text.DateFormat;
004import java.text.ParseException;
005
006/**
007 * A main program used to demonstrate the {@link Marriage} class.
008 *
009 * @see PersonMain
010 * @since Summer 2008
011 */
012public class MarriageMain {
013  /**
014   * A simple test program.
015   */
016  public static void main(String[] args) {
017    // Create my parent's marriage
018    Person me = PersonMain.me();
019    Person mom = PersonMain.mom(me);
020    Person dad = PersonMain.dad(me);
021
022    Marriage marriage = new Marriage(dad, mom);
023    marriage.setLocation("Durham, NH");
024
025    try {
026      DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
027      marriage.setDate(df.parse("Jul 12, 1969"));
028
029    } catch (ParseException ex) {
030      System.err.println("** Malformatted wedding day?");
031      System.exit(1);
032    }
033
034    mom.addMarriage(marriage);
035    dad.addMarriage(marriage);
036
037    // Print out some info
038    System.out.println(mom + "\n");
039    System.out.println(dad + "\n");
040    System.out.println(marriage + "\n");
041  }
042}