001package headfirst.observer.WeatherStation;
002
003public class CurrentConditionsDisplay implements Observer, DisplayElement {
004        private float temperature;
005        private float humidity;
006        //private Subject weatherData;
007
008        public CurrentConditionsDisplay(Subject weatherData) {
009                //this.weatherData = weatherData;
010                weatherData.registerObserver(this);
011        }
012
013        public void update(float temperature, float humidity, float pressure) {
014                this.temperature = temperature;
015                this.humidity = humidity;
016                display();
017        }
018
019        public void display() {
020                System.out.println("Current conditions: " + temperature
021                                + "F degrees and " + humidity + "% humidity");
022        }
023}