Ejemplo n.º 1
0
        public void AddChild(Man father, Woman mother)
        {
            Console.WriteLine("Введите пол нового человека (\"male\" или иное):");
            var sex = Console.ReadLine();

            if (sex == "male")
            {
                Children.Add(new Man(father, mother));
            }
            else
            {
                Children.Add(new Woman(father, mother));
            }
        }
Ejemplo n.º 2
0
        public void Born(Man father, Woman mother)
        {
            Father = father;
            Mother = mother;
            Console.WriteLine("Введите имя нового человека:");
            Name = Console.ReadLine();
            Console.WriteLine("Введите год рождения нового человека:");
            int year = 0;

            while (year < Math.Max(GetYearOfBirth(father), GetYearOfBirth(mother)) ||
                   !int.TryParse(Console.ReadLine(), out year))
            {
                Console.WriteLine("Ввод некорректный, попробуйте ещё раз:");
            }
        }
Ejemplo n.º 3
0
 public Man(Man father, Woman mother)
 {
     Born(father, mother);
     Console.WriteLine(Name + " родился =(");
 }
Ejemplo n.º 4
0
 public void AddChild(Woman mother)
 {
     mother.AddChild(this);
 }
Ejemplo n.º 5
0
 public void AddSpouse(Woman bride)
 {
     Console.WriteLine(Name + " женился на " + bride.Name + " =(");
     AddSpouse(bride);
 }
Ejemplo n.º 6
0
 public Woman(Man father, Woman mother)
 {
     Born(father, mother);
     Console.WriteLine(Name + " родилась! =)");
 }