예제 #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);
        }
예제 #2
0
 private static Human[] GenerateHumans(God god, int humansToCreate)
 {
     for (var i = 0; i < humansToCreate; i++)
     {
         god.CreateHuman();
     }
     return god.GetCreatedHumans();
 }
예제 #3
0
파일: Program.cs 프로젝트: mtashkinov/study
 private static void SaveTotalMoney(God god)
 {
     File.WriteAllText(outputFile, god.GetTotalMoney().ToString());
     Console.WriteLine(String.Format(Properties.Resources.MoneySaved, outputFile));
 }
예제 #4
0
 private static void SaveTotalMoney(God god)
 {
     File.WriteAllText(OutputFile, god.GetTotalMoney().ToString());
     Console.WriteLine(Properties.Resources.SavedMoney, OutputFile);
 }