Example #1
0
        public static void Main()
        {
            Console.WriteLine(Properties.Resources.Welcome);
            if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
            {
                Console.WriteLine(Properties.Resources.NoSundayWork);
                return;
            }
            var isInt = true;
            var amounOfHumansToCreate = 0;
            Console.WriteLine(Properties.Resources.HumansAmountQuestion);
            var readLine = Console.ReadLine();
            if (readLine != null) isInt = int.TryParse(readLine.Trim(), out amounOfHumansToCreate);
            if (!isInt || (amounOfHumansToCreate <= 0))
            {
                Console.WriteLine(Properties.Resources.InvalidHumansAmount);
                return;
            }

            var god = new God();
            var humans = GenerateHumans(god, amounOfHumansToCreate);
            PrintHumans(humans);

            Console.SetCursorPosition(0, Console.CursorTop - humans.Length * 2 + 1); //to printpairs
            PrintPairs(GeneratePairs(god, humans));
            SaveTotalMoney(god);
        }
Example #2
0
 private static Human[] GenerateHumans(God god, int humansToCreate)
 {
     for (var i = 0; i < humansToCreate; i++)
     {
         god.CreateHuman();
     }
     return god.GetCreatedHumans();
 }
Example #3
0
 private static void SaveTotalMoney(God god)
 {
     File.WriteAllText(outputFile, god.GetTotalMoney().ToString());
     Console.WriteLine(String.Format(Properties.Resources.MoneySaved, outputFile));
 }
Example #4
0
 private static void SaveTotalMoney(God god)
 {
     File.WriteAllText(OutputFile, god.GetTotalMoney().ToString());
     Console.WriteLine(Properties.Resources.SavedMoney, OutputFile);
 }