示例#1
0
 public void addColleague(AbstractEmployee employee) throws EmployeeException {
   if (!doesEmployeeExist(employee.getName())) {
     employees.add(employee);
   } else {
     throw new EmployeeException(
         "Employee " + employee.getName() + " already exists and cannot added again");
   }
 }
示例#2
0
 public boolean doesEmployeeExist(String name) {
   for (AbstractEmployee employee : employees) {
     if (employee.getName().equals(name)) {
       return true;
     }
   }
   return false;
 }
示例#3
0
 public void printAllEmployees() {
   for (AbstractEmployee employee : employees) {
     System.out.print(employee.toString() + "\n");
   }
 }
示例#4
0
 public void raiseSalary(AbstractEmployee employee) {
   employee.raiseSalary(employee);
 }