コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        public void Update(IMySubject weatherData)
        {
            _temperature = weatherData.GetTemperature();;
            _humidity    = weatherData.GetHumidity();

            Display();
        }
コード例 #4
0
        public void Update(IMySubject weatherData)
        {
            _temperature = weatherData.GetTemperature(); ;
            _humidity = weatherData.GetHumidity();

            Display();
        }
コード例 #5
0
 public void Update(IMySubject weatherData)
 {
     _heatindex = computeHeatIndex(weatherData.GetTemperature(), weatherData.GetHumidity());
 }
コード例 #6
0
 public void Update(IMySubject weatherData)
 {
     _heatindex = computeHeatIndex(weatherData.GetTemperature(), weatherData.GetHumidity());
 }