Example #1
0
        static void Main(string[] args)
        {
            string pathToData;

            if (!args.Any())
            {
                Console.WriteLine("No arguents passed assuming weather.dat file is in same directory as execcutable.");
                pathToData = "./weather.dat";
            }
            else
            {
                pathToData = args[0];
            }

            if (!File.Exists(pathToData))
            {
                Console.WriteLine($"Could not find data: {pathToData}");
                return;
            }

            var weatherData = new WeatherFileReader(pathToData).GetAll();
            var dayWithSmallestTempSread = new WeatherService(weatherData).GetDayWithSmallestTempSpread();

            Console.WriteLine($"The day with the samllest temperature spread is: {dayWithSmallestTempSread.Day}");

            Console.ReadKey();
        }
Example #2
0
        private bool IsWeatherSafe()
        {
            //Returns true if no weather alert, false if it is unsafe

            WeatherFileReader wmon = new WeatherFileReader();

            //if no weather file or other problem, return false
            if (wmon == null)
            {
                return(false);
            }
            if (wmon.AlertFlag == WeatherFileReader.WeaAlert.Alert)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }