added lab15 ex1

This commit is contained in:
2024-11-11 11:34:23 +01:00
parent ca9d0ec062
commit b964385405
5 changed files with 125 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package lab15_observer.ex1;
public class MedicalEmployee implements PatientObserver {
private final String name;
public MedicalEmployee(String name, PatientMonitoring pm) {
this.name = name;
pm.registerObserver(this);
}
public String getName() {
return name;
}
@Override
public void update(Problem problem, PatientMonitoring pm) {
System.out.println(getName() + " has been notified of " + problem + " for patient " + pm);
}
}