Example #1
0
        public LocalTemp GetTemperature(string zipCode)
        {
            var localTemp = new LocalTemp();

            localTemp.City  = _geoLookUpService.GetCityForZipCode(zipCode);
            localTemp.State = _geoLookUpService.GetStateForZipCode(zipCode);
            var coords = _geoLookUpService.GetCoordinatesForZipCode(zipCode);

            localTemp.Farenheight = _weatherService.GetTempFarenheight(coords.Latitude, coords.Longitude);
            localTemp.Celcius     = _converter.FarenheitToCelcius(localTemp.Farenheight);

            return(localTemp);
        }
        public static void Run()
        {
            string zipCode = "35080";

            GeoLookUpService geoLookUpService = new GeoLookUpService();
            var city   = geoLookUpService.GetCityForZipCode(zipCode);
            var state  = geoLookUpService.GetStateForZipCode(zipCode);
            var coords = geoLookUpService.GetCoordinatesForZipCode(zipCode);

            WeatherService weatherService = new WeatherService();
            var            farenheit      = weatherService.GetTempFarenheight(coords.Latitude, coords.Longitude);
            var            converter      = new EnglishMetricConverter();
            var            celcius        = converter.FarenheitToCelcius(farenheit);

            Console.WriteLine($"The current temperature is {farenheit}F /{celcius}C in {city}, {state}");
        }