package organization; import java.util.ArrayList; import java.util.List; import java.util.function.Predicate; import util.Gender; /** * This class represents the data and operations of any employee. It defines * all the operations that either ought to be common to all implementations, * or have a reasonable default to be overridden by them. */ public abstract class GenericEmployee implements Employee { protected String name; protected double pay; protected Gender gender; public GenericEmployee(String name,double pay, Gender gender) { this.name = name; this.pay = pay; this.gender = gender; } @Override public String getName() { return this.name; } @Override public Gender getGender() { return this.gender; } @Override public double getAnnualPay() { return this.pay; } /** * By default, there is no end date for an employee. Only contract * employees have an actual end date. * @return */ @Override public String getEmploymentEndDate() { return "XXXXXXXX"; } @Override public int count(Predicate condition) { if (condition.test(this)) { return 1; } return 0; } @Override public List toList() { List result = new ArrayList(); result.add(this); return result; } }