Exemplo n.º 1
0
        public static void Main()
        {
            Console.WriteLine(Methods.CalcTriangleArea(3, 4, 5));

            Console.WriteLine(Methods.NumberToDigit(5));

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

            Methods.PrintFormatWithPrecision(1.3);
            Methods.PrintNumberAsPersentige(0.75);
            Methods.PrintnumberAlignedRight(2.30);

            Console.WriteLine(Methods.CalculateDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + Methods.IsLineHorizontal(-1, 2.5));
            Console.WriteLine("Vertical? " + Methods.IsLineVertical(3, 3));
            Student peter = new Student("Peter", "Ivanov" );
            peter.OtherInfo = "From Sofia, born at 17.03.1992";
            Student stella = new Student("Stella", "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));
            Console.ReadLine();
        }
        public static void Main()
        {
            Console.WriteLine("Area: " + Methods.CalculateTriangleArea(3, 4, 5));

            Console.WriteLine("Number to digit: " + Methods.NumberToDigit(5));

            Console.WriteLine("Max element: " + Methods.FindMaxArrayElement(5, -1, 3, 2, 14, 2, 3));

            Console.WriteLine("Print as Number: ");
            Methods.PrintAsNumber(1.3, "round");
            Methods.PrintAsNumber(0.75, "percent");
            Methods.PrintAsNumber(2.30, "align right");

            Console.WriteLine("Distance: " + Methods.CalculateDistance(3, -1, 3, 2.5));
            Methods.IsLineHorizontal(3, -1, 3, 2.5);
            Methods.IsLineVertical(3, -1, 3, 2.5);

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

            Student stella = new Student("Stella", "Markova", new DateTime(1993, 03, 11), "From Vidin, gamer, high results");

            Console.WriteLine(
                                "{0} older than {1} -> {2}",
                                peter.FirstName,
                                stella.FirstName,
                                peter.IsOlder(stella));
        }
Exemplo n.º 3
0
        public bool IsOlderThan(Student other)
        {
            DateTime firstDate = this.BornDate;
            DateTime secondDate = other.BornDate;

            return firstDate > secondDate;
        }
Exemplo n.º 4
0
        public bool IsOlderThan(Student otherStudent)
        {
            DateTime firstDate = this.DateOfBirth;
            DateTime secondDate = otherStudent.DateOfBirth;

            return firstDate < secondDate;
        }
Exemplo n.º 5
0
        public bool IsOlderThan(Student other)
        {
            DateTime firstDate = this.BirthDate;
            DateTime secondDate = other.BirthDate;
            bool firstStudentIsOlder = firstDate < secondDate;

            return firstStudentIsOlder;
        }
Exemplo n.º 6
0
 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));
     bool isOlder = firstDate < secondDate;
     return isOlder;
 }
Exemplo n.º 7
0
        public static void Main()
        {
            Console.WriteLine(MathUtilities.CalculateTriangleArea(3, 4, 5));

            Console.WriteLine(MathUtilities.NumberToDigit(5));

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

            MathUtilities.PrintAsNumber(1.3M, "f");
            MathUtilities.PrintAsNumber(0.75M, "%");
            MathUtilities.PrintAsNumber(2.30M, "r");

            Console.WriteLine(MathUtilities.CalculateDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + MathUtilities.IsHorizontal(-1, 2.5));
            Console.WriteLine("Vertical? " + MathUtilities.IsVertical(3, 3));

            Student peter = new Student("Peter", "Ivanov", new DateTime(1992, 3, 17));
            Student stella = new Student("Stella", "Markova", new DateTime(1993, 11, 3));

            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Exemplo n.º 8
0
        public static void Main()
        {
            Console.WriteLine(Methods.CalculateTriangleArea(3, 4, 5));

            Console.WriteLine(Methods.DigitToString(5));

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

            Methods.NumberWithPrecisionTwoDigitsAfterTheDecimalPoint(1.3);
            Methods.NumberAsPercentage(0.75);
            Methods.NumberEightSignsRightAligned(2.30);

            Console.WriteLine(Methods.CalculateDistance(3, -1, 3, 2.5));
            Console.WriteLine("Is the line horizontal? " + Methods.IsLineHorizontal(3, -1));
            Console.WriteLine("Is the line vertical? " + Methods.IsLineVertical(3, 2.5));

            Student peter = new Student("Peter", "Ivanov", new DateTime(1992, 3, 17), "From Sofia");
            Student stella = new Student("Stella", "Markova", new DateTime(1993, 11, 3), "From Vidin, gamer, high results");

            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Exemplo n.º 9
0
 public bool IsOlder(Student otherStudent)
 {
     bool isOlder = this.DateOfBirth < otherStudent.DateOfBirth;
     return isOlder;
 }
Exemplo n.º 10
0
        private static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(NumberToDigit(5));

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

            PrintAsNumber(1.3, "f");
            PrintAsNumber(0.75, "%");
            PrintAsNumber(2.30, "r");

            Point firstPoint = new Point(3, -1);
            Point secondPoint = new Point(3, 2.5);

            Console.WriteLine(CalcDistance(firstPoint, secondPoint));
            Console.WriteLine("Horizontal? " + IsHorizontal(firstPoint, secondPoint));
            Console.WriteLine("Vertical? " + IsVertical(firstPoint, secondPoint));

            Student peter = new Student() { FirstName = "Peter", LastName = "Ivanov" };
            peter.OtherInfo = "From Sofia";
            peter.BornDate = new DateTime(1992, 3, 17);

            Student stella = new Student() { FirstName = "Stella", LastName = "Markova" };
            stella.OtherInfo = "From Vidin, gamer, high results";
            stella.BornDate = new DateTime(1993, 11, 3);

            Console.WriteLine("{0} older than {1} -> {2}",
                               peter.FirstName,
                               stella.FirstName,
                               peter.IsOlderThan(stella));
        }