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); }
private static Human[] GenerateHumans(God god, int humansToCreate) { for (var i = 0; i < humansToCreate; i++) { god.CreateHuman(); } return god.GetCreatedHumans(); }
private static void SaveTotalMoney(God god) { File.WriteAllText(outputFile, god.GetTotalMoney().ToString()); Console.WriteLine(String.Format(Properties.Resources.MoneySaved, outputFile)); }
private static void SaveTotalMoney(God god) { File.WriteAllText(OutputFile, god.GetTotalMoney().ToString()); Console.WriteLine(Properties.Resources.SavedMoney, OutputFile); }