Exemple #1
0
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            Family family = new Family();

            for (int i = 0; i < n; i++)
            {
                string[] personsArgs = Console.ReadLine()
                                       .Split();

                string name = personsArgs[0];
                int    age  = int.Parse(personsArgs[1]);

                Person person = new Person(name, age);
                family.AddMembers(person);
            }

            Person oldest = family.GetOldestMember();

            Console.WriteLine(oldest);

            List <Person> getPeopleOverThirty = family.GetPeopleOverThirty();

            Console.WriteLine(string.Join(Environment.NewLine, getPeopleOverThirty));

            string firstInputYear   = Console.ReadLine();
            string secoundInputYear = Console.ReadLine();

            DataModifier dateModifier = new DataModifier();

            var difference = dateModifier.CalculateTheDifference(firstInputYear, secoundInputYear);

            Console.WriteLine(difference);
        }
        public static void Main()
        {
            int memberCount = int.Parse(Console.ReadLine());

            Family family = new Family();

            for (int i = 0; i < memberCount; i++)
            {
                string[] peopleInput = Console.ReadLine()
                                       .Split(" ");
                string name = peopleInput[0];
                int    age  = int.Parse(peopleInput[1]);

                Person newMember = new Person(name, age);

                family.AddMember(newMember);
            }

            List <Person> PeopleOverThirty = family.GetPeopleOverThirty()
                                             .OrderBy(x => x.Name)
                                             .ToList();

            foreach (var member in PeopleOverThirty)
            {
                Console.WriteLine(member);
            }
        }
Exemple #3
0
        public static void Main()
        {
            int memberCount = int.Parse(Console.ReadLine());

            Family family = new Family();

            for (int i = 0; i < memberCount; i++)
            {
                string[] personArgs = Console.ReadLine()
                                      .Split();
                string name = personArgs[0];
                int    age  = int.Parse(personArgs[1]);

                Person person = new Person(name, age);
                family.AddMember(person);
            }

            //Person oldestMember = family.GetOldestMember();
            List <Person> peopleOverThirty = family.GetPeopleOverThirty().OrderBy(x => x.Name).ToList();

            //Console.WriteLine(oldestMember);
            Console.WriteLine(string.Join(Environment.NewLine, peopleOverThirty));
        }
        public static void Main(string[] args)
        {
            int    n      = int.Parse(Console.ReadLine());
            Family family = new Family();

            for (int i = 0; i < n; i++)
            {
                string[] info = Console.ReadLine().Split();

                string personName = info[0];
                int    personAge  = int.Parse(info[1]);

                Person person = new Person(personName, personAge);
                family.AddMember(person);
            }

            //Person oldestPerson = family.GetOldestMember();
            //Console.WriteLine(oldestPerson);


            List <Person> peopleOverThirty = family.GetPeopleOverThirty().OrderBy(x => x.Name).ToList();

            Console.WriteLine(string.Join(Environment.NewLine, peopleOverThirty));
        }