Exemple #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");
   }
 }
Exemple #2
0
 public boolean doesEmployeeExist(String name) {
   for (AbstractEmployee employee : employees) {
     if (employee.getName().equals(name)) {
       return true;
     }
   }
   return false;
 }
Exemple #3
0
 public void printAllEmployees() {
   for (AbstractEmployee employee : employees) {
     System.out.print(employee.toString() + "\n");
   }
 }
Exemple #4
0
 public void raiseSalary(AbstractEmployee employee) {
   employee.raiseSalary(employee);
 }