Beispiel #1
0
        /// <summary>
        /// Test method for the helper methods described above
        /// </summary>
        public static void Main()
        {
            Console.WriteLine("The area of triangle (3, 4, 5) is: {0}\n", TriangleArea(3, 4, 5));

            Console.WriteLine(NumberToDigit(5));
            ////            Console.WriteLine(NumberToDigit(55));
            Console.WriteLine();

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

            PrintAsNumber(1.3, FormatOptions.FixedPoint);
            PrintAsNumber(0.75, FormatOptions.Percent);
            PrintAsNumber(2.30, FormatOptions.AlignRight);
            Console.WriteLine();

            bool isHorizontal, isVertical;
            Console.Write("Line Segment (x1=3, y1=-1; x2=3, y2=2.5)\nLength: ");
            Console.WriteLine(LineSegmentLength(3, -1, 3, 2.5, out isHorizontal, out isVertical));
            Console.WriteLine("Is the line segment horizontal? " + isHorizontal);
            Console.WriteLine("Is the line segment vertical? " + isVertical);

            Student peter = new Student("Peter", "Ivanov");
            peter.DateOfBirth = new DateTime(1992, 03, 17);
            peter.Town = "Sofia";

            Student stella = new Student("Stella", "Markova");
            stella.DateOfBirth = new DateTime(1993, 11, 03);
            stella.Town = "Vidin";
            stella.Comment = "gamer, high results";

            Console.WriteLine(
                "\n{0} older than {1}? -> {2}\n",
                peter.FirstName,
                stella.FirstName,
                peter.IsOlderThan(stella));
        }
Beispiel #2
0
 /// <summary>
 /// The method compares the birth date of given student to other student's birthdate
 /// </summary>
 /// <param name="The other student whose birth date will be compared"></param>
 /// <returns>true - if the student is older then the other student</returns>
 public bool IsOlderThan(Student otherStudent)
 {
     return this.DateOfBirth < otherStudent.DateOfBirth;
 }