public void Update(WeatherObject wobject) { tempSum += wobject.Temperature; numReadings++; if (wobject.Temperature > maxTemp) { maxTemp = wobject.Temperature; } if (wobject.Temperature < minTemp) { minTemp = wobject.Temperature; } Console.WriteLine("Avg/Max/Min temperature = {0}/{1}/{2}", (tempSum / numReadings), maxTemp, minTemp); }
public void Update(WeatherObject wobject) { lastPressure = currentPressure; currentPressure = wobject.Presure; Console.Write("Forcast: "); if (currentPressure > lastPressure) { Console.WriteLine("Improving weather on the way!"); } else if (currentPressure == lastPressure) { Console.WriteLine("More of the same"); } else { Console.WriteLine("Watch out for cooler, rainy weather"); } }
public void Update(WeatherObject wobject) { Console.WriteLine("Current conditions: {0}F degrees and {1}% humility", wobject.Temperature, wobject.Humility); }
public void Update(WeatherObject wobject) { Console.WriteLine("Heat Index is {0}", computeHeatIndex(wobject.Temperature, wobject.Humility)); }
public void SetWeatherMeasurement(WeatherObject wobject) { _weatherObject = wobject; NotifyAll(); }