public static void Main(string[] args) { Family myFamily = new Family(); int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string[] line = Console.ReadLine().Split(); string name = line[0]; int age = int.Parse(line[1]); myFamily.AddMember(new Person(name, age)); } Person oldest = myFamily.GetOldestMember(); //Console.WriteLine($"{oldest.Name} {oldest.Age}"); foreach (var person in myFamily.PeopleMoreThen30Ears()) { Console.WriteLine(person); } }
static void Main(string[] args) { Family family = new Family(); int count = int.Parse(Console.ReadLine()); for (int i = 0; i < count; i++) { var tokens = Console.ReadLine().Split(); string name = tokens[0]; int age = int.Parse(tokens[1]); family.AddMember(new Person(name, age)); } Person oldestMember = family.GetOldestMember(); Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}"); }
public static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < n; i++) { string[] personData = Console.ReadLine().Split(); string name = personData[0]; int age = int.Parse(personData[1]); Person currentPerson = new Person(name, age); family.AddMember(currentPerson); } Person oldestMember = family.GetOldestMember(); Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}"); }
static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Family family = new Family(new List <Person>()); for (int i = 0; i < n; i++) { string[] personInfo = Console.ReadLine().Split(); Person person = new Person(personInfo[0], int.Parse(personInfo[1])); family.AddMember(person); } Person oldestMember = new Person(); oldestMember = family.GetOldestMember(); Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}"); }
static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < n; i++) { string[] line = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); string name = line[0]; int age = int.Parse(line[1]); Person person = new Person(age, name); family.AddMember(person); } Person oldestPerson = family.GetOldestMember(); Console.WriteLine(oldestPerson.Name + " " + oldestPerson.Age); }
static void Main(string[] args) { int entries = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < entries; i++) { string input = Console.ReadLine(); string name = input.Split()[0]; int age = int.Parse(input.Split()[1]); Person member = new Person(name, age); family.AddMember(member); } Person oldestMember = family.GetOldestMember(); Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}"); }
static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < n; i++) { string[] peoples = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); Person people = new Person(); people.Name = peoples[0]; people.Age = int.Parse(peoples[1]); family.AddMember(people); } Person oldest = family.GetOldestMember(); Console.WriteLine(oldest.Name + " " + oldest.Age); }
public static void Main() { int people = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 1; i <= people; i++) { string[] input = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries); string name = input[0]; int age = int.Parse(input[1]); family.AddMember(new Person(name, age)); } Person oldestMember = family.GetOldestMember(); Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}"); }
public static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < n; i++) { string[] pData = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); string name = pData[0]; int age = int.Parse(pData[1]); Person currPerson = new Person(name, age); family.AddMember(currPerson); } Person oldestPerson = family.GetOldestMember(); Console.WriteLine($"{oldestPerson.Name} {oldestPerson.Age}"); }
public static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); var family = new Family(); for (int i = 0; i < n; i++) { var people = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries); var name = people[0]; var age = int.Parse(people[1]); var person = new Person(name, age); family.AddMember(person); } var oldestMember = family.GetOldestMember(); Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}"); }
public static void Main(string[] args) { int numberOfNames = int.Parse(Console.ReadLine()); for (int i = 0; i < numberOfNames; i++) { string[] currentMember = Console.ReadLine().Split(); string memberName = currentMember[0]; int memberAge = int.Parse(currentMember[1]); Person person = new Person(memberName, memberAge); Family.AddMemberToDictionary(person); } string oldestMember = Family.GetOldestMember(); Console.WriteLine(oldestMember); }
public static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); var family = new Family(); for (int i = 0; i < n; i++) { var man = Console.ReadLine().Split().ToArray(); var name = man[0]; var age = int.Parse(man[1]); Person person = new Person(name, age); family.AddMember(person); } var oldesMember = family.GetOldestMember(); Console.WriteLine(oldesMember); }
public static void Main(string[] args) { int familyMembersCount = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < familyMembersCount; i++) { string[] memberData = Console.ReadLine().Split(); string memberName = memberData[0]; int memeberAge = int.Parse(memberData[1]); Person member = new Person(memberName, memeberAge); family.AddMember(member); } Person oldestFamilyMember = family.GetOldestMember(); Console.WriteLine($"{oldestFamilyMember.Name} {oldestFamilyMember.Age}"); }
static void Main() { int membersCount = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < membersCount; 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(); Console.WriteLine(oldestMember); }
static void Main(string[] args) { Family family = new Family(); int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { string[] input = Console.ReadLine().Split(); string name = input[0]; int age = int.Parse(input[1]); Person person = new Person(name, age); family.AddMember(person); } Person oldestPerson = family.GetOldestMember(); Console.WriteLine($"{oldestPerson.Name} {oldestPerson.Age}"); }
public static void Main(string[] args) { int numbers = int.Parse(Console.ReadLine()); for (int i = 0; i < numbers; i++) { var input = Console.ReadLine().Split(); var name = input[0]; var age = int.Parse(input[1]); Person person = new Person(age, name); Family.AddMember(person); } Person oldestMember = Family.GetOldestMember(); Console.WriteLine(oldestMember); }
static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < n; i++) { string[] input = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries); Person member = new Person(input[0], int.Parse(input[1])); family.AddMember(member); } Person oldest = family.GetOldestMember(); Console.WriteLine(oldest); }
static void Main(string[] args) { int num = int.Parse(Console.ReadLine()); Family family = new Family(); family.Members = new List <Person>(); for (int i = 0; i < num; i++) { var data = Console.ReadLine().Split().ToArray(); string name = data[0]; int age = int.Parse(data[1]); Person member = new Person(name, age); family.AddMember(member); } var oldest = family.GetOldestMember(); Console.WriteLine($"{oldest.Name} {oldest.Age}"); }
static void Main(string[] args) { int familyMembers = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < familyMembers; i++) { string[] currentPersonAndAge = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries); string currentPerson = currentPersonAndAge[0]; int personAge = int.Parse(currentPersonAndAge[1]); Person person = new Person(currentPerson, personAge); family.AddMember(person); } Person oldestPerson = family.GetOldestMember(); Console.WriteLine($"{oldestPerson.Name} {oldestPerson.Age}"); }
public static void Main() { var counter = int.Parse(Console.ReadLine()); var family = new Family(); for (int i = 0; i < counter; i++) { var input = Console.ReadLine().Split().ToArray(); var name = input[0]; var age = int.Parse(input[1]); var person = new Person(name, age); family.AddMember(person); } var oldestPerson = family.GetOldestMember(); Console.WriteLine(oldestPerson); }
public static void Main(string[] args) { int peopleCount = int.Parse(Console.ReadLine()); Family family = new Family(); family.People = new List <Person>(); for (int i = 0; i < peopleCount; i++) { string[] tokens = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); string name = tokens[0]; int age = int.Parse(tokens[1]); Person person = new Person(name, age); family.AddMember(person); } Person oldestPerson = family.GetOldestMember(); Console.WriteLine($"{oldestPerson.Name} {oldestPerson.Age}"); }
static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < n; i++) { string[] data = Console.ReadLine().Split(); string memberName = data[0]; int memberAge = int.Parse(data[1]); Person member = new Person(memberName, memberAge); family.AddMember(member); } Person oldestFamilyPerson = family.GetOldestMember(); Console.WriteLine($"{oldestFamilyPerson.Name} {oldestFamilyPerson.Age}"); }
public static void Main() { int numberOfPeople = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < numberOfPeople; i++) { string[] peopleData = Console.ReadLine() .Split(' ', StringSplitOptions.RemoveEmptyEntries); string name = peopleData[0]; int age = int.Parse(peopleData[1]); Person person = new Person(name, age); family.AddMember(person); } Person oldestMember = family.GetOldestMember(); Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}"); }
public static void Main() { int membersCount = int.Parse(Console.ReadLine()); Family members = new Family(); for (int i = 0; i < membersCount; i++) { string[] input = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries); string name = input[0]; int age = int.Parse(input[1]); Person person = new Person(name, age); members.AddMember(person); } Person oldestPerson = members.GetOldestMember(); Console.WriteLine($"{oldestPerson.Name} {oldestPerson.Age}"); }
static void Main(string[] args) { int length = int.Parse(Console.ReadLine()); var family = new Family(); for (int i = 0; i < length; i++) { string[] input = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries); string name = input[0]; int age = int.Parse(input[1]); var currentPerson = new Person(name, age); family.AddMember(currentPerson); } var oldestMember = family.GetOldestMember(); Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}"); }
public static void Main(string[] args) { var numOfPeople = int.Parse(Console.ReadLine()); Family family = new Family(new List <Person>()); for (int i = 0; i < numOfPeople; i++) { var entries = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); var name = entries[0]; var age = int.Parse(entries[1]); var currentPerson = new Person(name, age); family.AddMember(currentPerson); } var oldestPerson = family.GetOldestMember(); Console.WriteLine($"{oldestPerson.Name} {oldestPerson.Age}"); }
static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); List <Person> members = new List <Person>(); Family family = new Family(members); for (int i = 0; i < n; i++) { string[] familyInput = Console.ReadLine().Split(); string name = familyInput[0]; int age = int.Parse(familyInput[1]); Person currPerson = new Person(name, age); family.AddMember(currPerson); } Person oldestMember = family.GetOldestMember(members); Console.WriteLine($"{oldestMember.Name} {oldestMember.Age}"); }
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}"); }
public static void Main() { int n = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < n; i++) { string[] details = Console.ReadLine().Split(" "); string name = details[0]; int age = int.Parse(details[1]); Person person = new Person(name, age); family.AddMember(person); } Person oldest = family.GetOldestMember(); Console.WriteLine(oldest.Name + " " + oldest.Age); }
static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); Family family = new Family(); for (int i = 0; i < n; i++) { string[] tokens = Console.ReadLine() .Split(' ', StringSplitOptions.RemoveEmptyEntries); string name = tokens[0]; int age = int.Parse(tokens[1]); Person person = new Person(name, age); family.AddMember(person); } Person oldest = family.GetOldestMember(); Console.WriteLine($"{oldest.Name} {oldest.Age}"); }