// Project: Patterns1 // Module: employeefactory // Source code file: empfactory/Person.java // Illustrate the Factory software pattern. // The getInstance method can create objects from // three different classes. package empfactory; public class Person { protected String name; protected char gender; protected int age; // Constructor has package (default) accessibility. Person( ) { } // Only define setters, no getters. public void setName(String theName) { name = theName; } public void setGender(char theGender) { gender = theGender; } public void setAge(int theAge) { age = theAge; } public String toString( ) { return String.format("%s %c %d", name, gender, age); } }