added observer sample

This commit is contained in:
Ilkka Seppala
2014-08-22 21:57:54 +03:00
parent 6246ed6d26
commit b3d48cc4df
8 changed files with 163 additions and 0 deletions
@@ -0,0 +1,25 @@
package com.iluwatar;
public class Hobbits implements WeatherObserver {
@Override
public void update(WeatherType currentWeather) {
switch (currentWeather) {
case COLD:
System.out.println("The hobbits are shivering in the cold weather.");
break;
case RAINY:
System.out.println("The hobbits look for cover from the rain.");
break;
case SUNNY:
System.out.println("The happy hobbits bade in the warm sun.");
break;
case WINDY:
System.out.println("The hobbits hold their hats tightly in the windy weather.");
break;
default:
break;
}
}
}