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 SafeUserAge {

  public static void main(String[] args) {

    Scanner keybd = new Scanner(System.in);

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

    try {
      //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 " + (2008 - yob));

    }catch (InputMismatchException ime) {
      //user didn't enter a number
      System.out.println("You must enter an integer.  Please try again.");
    }

  }

}
