Example #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);
        }
Example #2
0
        public static void Main(string[] args)
        {
            var family = new Family();
            int count  = int.Parse(Console.ReadLine());

            for (int i = 0; i < count; i++)
            {
                var    command = Console.ReadLine().Split();
                string name    = command[0];
                int    age     = int.Parse(command[1]);
                var    person  = new Person(name, age);
                family.AddMembers(person);
            }

            family.ReturnOldestMembers();
        }
Example #3
0
        static void Main(string[] args)
        {
            Family family       = new Family();
            int    membersCount = int.Parse(Console.ReadLine());

            for (int i = 0; i < membersCount; i++)
            {
                var    input  = Console.ReadLine().Split().ToArray();
                string name   = input[0];
                int    age    = int.Parse(input[1]);
                Person person = new Person(age, name);
                family.AddMembers(person);
            }

            Console.WriteLine(family.GetOldestMember().Name + " " + family.GetOldestMember().Age);
        }
Example #4
0
        public static void Main(string[] args)
        {
            var    n       = int.Parse(Console.ReadLine());
            Family members = new Family();

            for (int i = 0; i < n; i++)
            {
                var input = Console.ReadLine().Split();
                var name  = input[0];
                var age   = int.Parse(input[1]);

                Person person = new Person(name, age);

                members.AddMembers(person);
            }
            members.GetOldestMember();
        }
Example #5
0
        static void Main(string[] args)
        {
            int count  = int.Parse(Console.ReadLine());
            var family = new Family();


            for (int i = 0; i < count; i++)
            {
                string[] input  = Console.ReadLine().Split();
                var      person = new Person(input[0], int.Parse(input[1]));
                family.AddMembers(person);
            }



            var result = family.GetOldesMember();

            Console.WriteLine($"{result.Name} {result.Age }");
        }
Example #6
0
        public static void Main(string[] args)
        {
            int    n      = int.Parse(Console.ReadLine());
            Family family = new Family();

            for (int i = 0; i < n; i++)
            {
                //that reads the names and ages of N people
                string[] personData = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);
                string   name       = personData[0];
                int      age        = int.Parse(personData[1]);

                Person currPerson = new Person(name, age);
                // Members.Add(currPerson);
                family.AddMembers(currPerson);
            }

            Person oldestMember = family.GetOldestMember();

            Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}");
        }
Example #7
0
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            Family family = new Family();

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

                var person = new Person(name, age);

                family.AddMembers(person);
            }

            Person oldestPerson = family.GetOldestMember();

            Console.WriteLine($"{oldestPerson.Name} {oldestPerson.Age}");
        }