public bool IsOlderThan(Student other) { DateTime firstDate = DateTime.Parse(this.OtherInfo.Substring(this.OtherInfo.Length - 10)); DateTime secondDate = DateTime.Parse(other.OtherInfo.Substring(other.OtherInfo.Length - 10)); return firstDate > secondDate; }
public static void Main() { Console.WriteLine(CalculateTriangleArea(3, 4, 5)); Console.WriteLine(DigitToWord(5)); Console.WriteLine(FindMaximalNumber(5, -1, 3, 2, 14, 2, 3)); PrintNumberInGivenFormat(1.3, 'f'); PrintNumberInGivenFormat(0.75, '%'); PrintNumberInGivenFormat(2.30, 'r'); bool horizontal, vertical; Console.WriteLine(CalculcateDistance(3, -1, 3, 2.5, out horizontal, out vertical)); Console.WriteLine("Horizontal? " + horizontal); Console.WriteLine("Vertical? " + vertical); Student peter = new Student() { FirstName = "Peter", LastName = "Ivanov" }; peter.OtherInfo = "From Sofia, born at 17.03.1992"; Student stella = new Student() { FirstName = "Stella", LastName = "Markova" }; stella.OtherInfo = "From Vidin, gamer, high results, born at 03.11.1993"; Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella)); }