Your First Cup: An Introduction to the Java EE Platform

ProcedureAdding Properties to the Bean

During this task, you will add the following properties to the DukesBDay bean:

  1. Right-click in the Editor window, select Insert Code, then Add Property.

  2. Enter age under Name, and set the Type to int, click OK.

  3. Repeat the above steps to create the following properties: yourBD of type java.util.Date, ageDiff of type int, absAgeDiff of type int, and averageAgeDifference of type Double.

  4. After the newly created property fields, add the following Logger instance:

    private static Logger logger = Logger.getLogger("firstcup.web.DukesBDay");
  5. Initialize the variables in the default constructor:

    public DukesBDay() {
    	age = -1;
    	yourBD = null;
    	ageDiff = -1;
    	absAgeDiff = -1;
  6. Right-click in the editor and select Format.

  7. Right-click in the editor and select Fix Imports.

  8. Select java.util.logging.Logger for the Logger class, and click OK.