static void Main(string[] args)
        {
            WeatherData weatherData = new WeatherData();

            CurrentConditionsDisplay currentDisplay    = new CurrentConditionsDisplay(weatherData);
            StatisticsDisplay        statisticsDisplay = new StatisticsDisplay(weatherData);
            ForecastDisplay          forecastDisplay   = new ForecastDisplay(weatherData);
            HeatIndexDisplay         heatIndexDisplay  = new HeatIndexDisplay(weatherData);

            // create the readings
            WeatherMeasurements readings = new WeatherMeasurements();

            readings.Temperature = 80f;
            readings.Humidity    = 65f;
            readings.Pressure    = 30.4f;

            weatherData.Mesurements(readings);

            readings.Temperature = 82f;
            readings.Humidity    = 70f;
            readings.Pressure    = 29.2f;
            weatherData.Mesurements(readings);

            readings.Temperature = 78f;
            readings.Humidity    = 90f;
            weatherData.Mesurements(readings);
        }
        public void Update(WeatherMeasurements measurements)
        {
            lastPressure    = currentPressure;
            currentPressure = measurements.Pressure;

            Display();
        }
        public void Update(WeatherMeasurements measurements)
        {
            tempSum += measurements.Temperature;
            numReadings++;

            if (measurements.Temperature > maxTemp)
            {
                maxTemp = measurements.Temperature;
            }

            if (measurements.Temperature < minTemp)
            {
                minTemp = measurements.Temperature;
            }

            Display();
        }
Exemple #4
0
 public void Mesurements(WeatherMeasurements measurements)
 {
     this.weatherMeasurements = measurements;
     MeasurementsChanged();
 }
 public void Update(WeatherMeasurements measurements)
 {
     this.temperature = measurements.Temperature;
     this.humidity    = measurements.Humidity;
     Display();
 }
 public void Update(WeatherMeasurements measurements)
 {
     heatIndex = computeHeatIndex(measurements.Temperature, measurements.Humidity);
     Display();
 }