Exemplo n.º 1
0
        //Main starts here
        //
        //**************************************************************************
        static void Main(string[] args)
        {
            Thousand yeah = new Thousand();
            int      test;

            Console.WriteLine("Please enter the amount of hours per week you plan on practicing.");
            //Input Validation to prevent any non Int or negative values from being entered
            while (!int.TryParse(Console.ReadLine(), out test))
            {
                Console.WriteLine("Invalid Input. Please enter a positive whole number.");
            }
            while (test < 0)
            {
                Console.WriteLine("Invalid Input. Please enter a positive whole number.");
                while (!int.TryParse(Console.ReadLine(), out test))
                {
                    Console.WriteLine("Invalid Input. Please enter a positive whole number.");
                }
            }

            yeah.calculateWeeks(test);
            yeah.tenThousandTimes(yeah.weeks);


            //Console.WriteLine(yeah.weeks);
            //Console.WriteLine(yeah.days);
            //Console.WriteLine(yeah.months);
            //Console.WriteLine(yeah.years);

            //DateTime is used to get the exact date when the program is run
            //The class variables are then used to add the time to the current date.
            //Variables are typecasted to integers in order for it to work
            DateTime now    = DateTime.UtcNow.Date;
            DateTime days   = now.AddDays((int)yeah.days);
            DateTime months = days.AddMonths((int)yeah.months);
            DateTime later  = months.AddYears((int)yeah.years);

            yeah.printResults();


            Console.Write("\nCurrent Date is : ");
            Console.WriteLine(now.ToString("MM/dd/yyyy"));
            Console.Write("You will reach your Ten Thousand Hours on : ");
            Console.WriteLine(later.ToString("MM/dd/yyyy"));
            Console.ReadLine();
        }