public void Update(IMySubject weatherData) { var temperature = weatherData.GetTemperature(); _numberofreadings++; _sumtemperature += temperature; if (_numberofreadings == 1) { // first reading so default both to the same temperature _maxtemperature = temperature; _mintemperature = temperature; } else { // do checks if (temperature > _maxtemperature) { _maxtemperature = temperature; } if (temperature < _mintemperature) { _mintemperature = temperature; } } Display(); }
public void Update(IMySubject weatherData) { _lastpressure = _currentpressure; _currentpressure = weatherData.GetPressure(); Display(); }
public void Update(IMySubject weatherData) { _temperature = weatherData.GetTemperature();; _humidity = weatherData.GetHumidity(); Display(); }
public void Update(IMySubject weatherData) { _temperature = weatherData.GetTemperature(); ; _humidity = weatherData.GetHumidity(); Display(); }
public void Update(IMySubject weatherData) { _heatindex = computeHeatIndex(weatherData.GetTemperature(), weatherData.GetHumidity()); }
public HeatIndexDisplay(IMySubject weatherdata) { weatherdata.RegisterObserver(this); }
public StatisticsDisplay(IMySubject weatherData) { weatherData.RegisterObserver(this); }
public ForecastDisplay(IMySubject weatherData) { weatherData.RegisterObserver(this); }
public CurrentConditionsDisplay(IMySubject weatherData) { weatherData.RegisterObserver(this); }