/** * A FacultyCardFactory is a CardFactory that creates cards for * faculty members. **/ public class FacultyCardFactory extends CardFactory { private static final int CARD_COST = 1; protected static FacultyCardFactory cardFactory = new FacultyCardFactory(); private FacultyCardFactory() { //suppress default no-arg constructor } /** * @return an instance of CardFactory. this class cannot be * instantiated directly; instances can ONLY be acquired through * this method. */ public FacultyCardFactory getInstance() { return this.cardFactory; } /** * A factory method to produce a new card. * @throws NotFacultyException if name and idNumber do not refer to * a faculty member * @return a new Card for the person with name 'name' and id number * 'idNumber', that gives access to the buildings in privileges. * The card is a faculty card -- the background is white, and * "Faculty" is printed on the card. **/ public Card createCard(String name, String idNumber) { List accessPrivileges = PersonnelOffice.getFacultyPrivileges(idNumber); chargeBursar(CARD_COST); return new Card(name, idNumber, CARD_COLOR, "Faculty", accessPrivileges); } }