Exemple #1
0
 /// <summary>
 /// The method compares two students by their birth date.
 /// </summary>
 /// <returns>Boolean variable - true if the first students is older than the second, false - otherwise</returns>
 public bool IsOlderThan(Student other)
 {
     return this.BirthDate < other.BirthDate;
 }
Exemple #2
0
        /// <summary>
        /// The method tests all methods, that needed refactoring
        /// </summary>
        internal static void Main()
        {
            Console.WriteLine(CalculateTriangleArea(3, 4, 5));

            Console.WriteLine(NumberToDigit(5));

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

            PrintAsNumber(1.3, FormatOptions.Round);
            PrintAsNumber(0.75, FormatOptions.Percent);
            PrintAsNumber(2.30, FormatOptions.AlignRight);

            double firstPointX = 3.0;
            double firstPointY = -1.0;
            double secondPointX = 3.0;
            double secondPointY = 2.5;
            double distance = CalcDistanceBetweenPoints(firstPointX, firstPointY, secondPointX, secondPointY);
            Console.WriteLine(distance);
            Position linePosition = GetLinePosition(firstPointX, firstPointY, secondPointX, secondPointY);
            Console.WriteLine("Connecting line position: " + linePosition);

            Student peter = new Student("Peter", "Ivanov", new DateTime(1992, 3, 17), "Sofia");
            Student stella = new Student("Stella", "Markova", new DateTime(1993, 3, 11), "Vidin", "gamer, high results");
            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }