Ejemplo n.º 1
0
        internal static void Main()
        {
            Console.WriteLine(CalculateTriangleArea(3, 4, 5));

            Console.WriteLine(NumberToDigit(5));

            Console.WriteLine(FindMax(5, -1, 3, 2, 14, 2, 3));

            PrintFormatedNumberToConsole(1.3, StringFormatOtions.TwoDigitsAfterDecimalPoint);
            PrintFormatedNumberToConsole(0.75, StringFormatOtions.Persent);
            PrintFormatedNumberToConsole(2.30, StringFormatOtions.ShiftRight);

            bool isHorizontal = IsLineHorizontal(3, -1);
            bool isVertical = IsLineVertical(3, 2.5);
            Console.WriteLine("Horizontal? " + isHorizontal);
            Console.WriteLine("Vertical? " + isVertical);

            Console.WriteLine(CalcDistance(3, -1, 3, 2.5));

            Student peter = new Student("Peter", "Ivanov", "From Sofia, born at 17.03.1992");
            Student stella = new Student("Stella", "Markova", "From Vidin, gamer, high results, born at 03.11.1993");

            var isPeterOlder = peter.IsOlderThan(stella);
            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, isPeterOlder);
        }
Ejemplo n.º 2
0
        public bool IsOlderThan(Student other)
        {
            if (other == null)
            {
                throw new ArgumentNullException("You need to pass a Student object");
            }

            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;
        }