Beispiel #1
0
        private static HypoDate ReadDate()
        {
            var year  = ReadYear();
            var month = ReadMonth();
            var day   = ReadDay(month, year);

            var date = new HypoDate(year, month, day);

            return(date);
        }
Beispiel #2
0
        private static int ReadDay(int month, int year)
        {
            var maxDay = HypoDate.GetMaxDaysPerMonthList(year)[month];

            var day = 0;

            do
            {
                Console.WriteLine("Please, enter a day for the month {0} of the year {1}. A day between 1 and {2}.", month, year, maxDay);
                day = ReadInteger();
            }while (day < 1 || day > maxDay);

            return(day);
        }
Beispiel #3
0
        private static void PrintReport(HypoDate from, HypoDate to)
        {
            var days = HypoDate.GetElapsedDays(from, to);

            Console.WriteLine("Report: The experiment has taken {0} days.", days);
        }
Beispiel #4
0
 private static bool IsValidRange(HypoDate from, HypoDate to)
 {
     return(@from.AbsoluteDays <= to.AbsoluteDays);
 }
Beispiel #5
0
 public static int GetElapsedDays(HypoDate from, HypoDate to)
 {
     return(to.AbsoluteDays - from.AbsoluteDays - 1); // Discounts no fully elapsed day.
 }