import java.util.Scanner;
import java.util.InputMismatchException;

/**
 * Asks the user for their name and year of birth,
 * and then prints their name and age to the screen.
 *
 * @author Zach Tomaszewski
 */
public class UserAge {

  public static void main(String[] args) {
    try {
      Scanner keybd = new Scanner(System.in);

      //get user's name
      System.out.print("Enter your name: ");
      String name = keybd.nextLine();

      //get user's year of birth
      System.out.print("Enter your year of birth: ");
      int yob = keybd.nextInt();

      //print user's details
      System.out.println("Your name is " + name);
      System.out.println("Your age is " + (2009 - yob));

    }catch (InputMismatchException ime) {
      System.out.println("You must enter an integer for your year of birth.");
    }
  }
}
