IsOlderThan() public method

public IsOlderThan ( Student other ) : bool
other Student
return bool
Ejemplo n.º 1
0
        public static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            Console.WriteLine(Methods.CalculateTriangleArea(3, 4, 5));

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

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

            var printer = new FormatPrinter();

            Console.WriteLine(printer.PrintWithPrecisionTowDigit(1.3));
            Console.WriteLine(printer.PrintAsPercentage(0.75));
            Console.WriteLine(printer.PrintAlignedRight(2.30));

            Console.WriteLine(Methods.CalculateDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + Methods.CheckIfHorizontalLine(3, 3));
            Console.WriteLine("Vertical? " + Methods.ChekIfVertivcalLine(-1, 2.5));

            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($"{peter.FirstName} older than {stella.FirstName} -> {peter.IsOlderThan(stella)}");
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            Console.WriteLine(Methods.CalculateTriangleArea(3, 4, 5));

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

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

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

            bool horizontal = Methods.IsLineHorizontal(-1, 2.5);
            bool vertical   = Methods.IsLineVertical(3, 3);

            Console.WriteLine(Methods.CalculateDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

            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} {1} older than {2} {3} -> {4}",
                peter.FirstName,
                peter.LastName,
                stella.FirstName,
                stella.LastName,
                peter.IsOlderThan(stella));
        }
Ejemplo n.º 3
0
        public static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(NumberToText(5));

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

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

            bool horizontal, vertical;
            Console.WriteLine(CalcDistance(3, -1, 3, 2.5, out horizontal, out vertical));
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

            Student peter = new Student("Peter", "Ïvanov", "Sofia", new DateTime(1992, 3, 17));
            Student stella = new Student("Stella", "Markova", "Vidin", new DateTime(1993, 11, 3));

            var isOlderThan = peter.IsOlderThan(stella);
            if (isOlderThan < 0)
            {
                Console.WriteLine("Is older");
            }
            else if (isOlderThan > 0)
            {
                Console.WriteLine("Is younger");
            }
            else
            {
                Console.WriteLine("Are on the same age");
            }
        }
Ejemplo n.º 4
0
        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, PrintFormat.twoFloatDigits);
            PrintAsNumber(0.75, PrintFormat.percentage);
            PrintAsNumber(2.30, PrintFormat.precededByEightSpaces);

            bool horizontal, vertical;

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

            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));
        }
        private static void Main()
        {
            Console.WriteLine(Methods.CalculateTriangleArea(3, 4, 5));

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

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

            Methods.NumberWithPrecision(1.3);
            Methods.NumberAsPercentage(0.75);
            Methods.NumberRightAligned(2.30);

            bool   isHorizontal = Methods.IsLineHorizontal(-1, 2.5);
            bool   isVertical   = Methods.IsLineVertical(3, 3);
            double distance     = Methods.CalculateDistance(3, -1, 3, 2.5);

            Console.WriteLine(distance);
            Console.WriteLine("Horizontal? : " + isHorizontal);
            Console.WriteLine("Vertical? : " + isVertical);

            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));
        }
Ejemplo n.º 6
0
        public static void Main()
        {
            Console.WriteLine(MathUtils.CalculateTriangleArea(3, 4, 5));

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

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

            NumberUtils.PrintAsNumber(1.3, FormatSpecifier.Precision);
            NumberUtils.PrintAsNumber(0.75, FormatSpecifier.Percent);
            NumberUtils.PrintAsNumber(2.30, FormatSpecifier.RightAlignment);

            double firstPointX = 3.0;
            double firstPointY = -1.0;
            double secondPointX = 3.0;
            double secondPointY = 2.5;

            double lineLength = MathUtils.CalculateDistanceBetweenTwoPoints(firstPointX, firstPointY, secondPointX, secondPointY);
            Console.WriteLine(lineLength);

            LineType lineType = MathUtils.GetLineType(firstPointX, firstPointY, secondPointX, secondPointY);
            Console.WriteLine("Line type: " + lineType);

            Student peter = new Student("Peter", "Ivanov", "Sofia", new DateTime(1992, 3, 17));
            Student stela = new Student("Stela", "Markova", "Vidin", new DateTime(1993, 11, 3), new string[] { "Gamer", "High results" });

            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stela.FirstName, peter.IsOlderThan(stela));
        }
Ejemplo n.º 7
0
        static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(NumberToDigit(5));

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

            PrintNumberWithFixedPoint(1.3, 2);
            PrintNumberPercent(0.75);
            PrintNumberWithSpaces(2.30, 8);

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

            Student peter = new Student()
            {
                FirstName = "Peter", LastName = "Ivanov"
            };

            peter.OtherInfo = "From Sofia";
            peter.BirthDate = DateTime.Parse("17.03.1992");

            Student stella = new Student()
            {
                FirstName = "Stella", LastName = "Markova"
            };

            stella.OtherInfo = "From Vidin, gamer, high results";
            stella.BirthDate = DateTime.Parse("03.11.1993");

            Console.WriteLine("{0} older than {1} -> {2}",
                              peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 8
0
Archivo: Methods.cs Proyecto: GAlex7/TA
        public static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(NumberToDigit(5));

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

            PrintNumberWithPrecision(1.3);
            PrintNumberAsPercentage(0.75);
            PrintNumberAlignedRight(2.30);

            bool horizontal, vertical;
            Console.WriteLine(CalcDistance(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.DateOfBirth = new DateTime(1992, 3, 17);
            peter.OtherInfo = "From Sofia";

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

            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 9
0
        public 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");

            bool horizontal, vertical;
            Console.WriteLine(CalculateDistanceBetweenTwoPoints(3, -1, 3, 2.5));
            CheckingIsHorizontalOrVertical(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";

            bool isOlderThan = peter.IsOlderThan(stella);

            Console.WriteLine(
                "{0} older than {1} -> {2}",
                peter.FirstName,
                stella.FirstName,
                isOlderThan);
        }
Ejemplo n.º 10
0
        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");

            Console.WriteLine(CalcDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + isHorizontal(3, 3));
            Console.WriteLine("Vertical? " + isVertical(-1, 2.5));

            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));
        }
Ejemplo n.º 11
0
        private static void Main()
		{
			Console.WriteLine(Methods.CalcTriangleArea(3, 4, 5));

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

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

			Methods.FormatNumber(1.3, "f");
			Methods.FormatNumber(0.75, "%");
			Methods.FormatNumber(2.30, "r");

			bool horizontal = Methods.IsHoryzontal(3, -1, 3, 2.5);
			bool vertical = Methods.IsVertical(3, -1, 3, 2.5);
			Console.WriteLine(Methods.CalcDistance(3, -1, 3, 2.5));
			Console.WriteLine("Horizontal? " + horizontal);
			Console.WriteLine("Vertical? " + vertical);

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

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

			Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
		}
Ejemplo n.º 12
0
        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");

            bool horizontal, vertical;

            Console.WriteLine(CalcDistance(3, -1, 3, 2.5, out horizontal, out vertical));
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

            Student Alex = new Student()
            {
                FirstName = "Alex", LastName = "Den"
            };

            Alex.OtherInfo = "From Sofia, born at 7.12.1996";

            Student Ler = new Student()
            {
                FirstName = "Ler", LastName = "Mater"
            };

            Ler.OtherInfo = "From Burgas, coder, high results, born at 10.11.1996";

            Console.WriteLine("{0} older than {1} -> {2}",
                              Alex.FirstName, Ler.FirstName, Alex.IsOlderThan(Ler));
        }
        private static void Main()
        {
            Console.WriteLine(Methods.CalculateTriangleArea(3, 4, 5));

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

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

            Methods.NumberWithPrecision(1.3);
            Methods.NumberAsPercentage(0.75);
            Methods.NumberRightAligned(2.30);

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

            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));
        }
Ejemplo n.º 14
0
        static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(NumberToDigit(5));

            int[] arrayOfIntegers = { 5, -1, 3, 2, 14, 2, 3 };
            Console.WriteLine(FindMax(arrayOfIntegers));

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

            bool horizontal, vertical;
            Console.WriteLine(CalcDistance(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";
            peter.YearBorn = 1992;

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

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

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

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

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

            bool horizontal, vertical;
            Console.WriteLine(Methods.CalcDistance(3, -1, 3, 2.5, out horizontal, out vertical));
            Console.WriteLine("Horizontal? {0}", horizontal ? "true" : "false");
            Console.WriteLine("Vertical? {0}", vertical ? "true" : "false");

            var peter = new Student()
            {
                FirstName = "Peter",
                LastName = "Ivanov",
            };
            peter.OtherInfo = "From Sofia, born at 17.03.1992";

            var 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) ? "true" : "false");
        }
Ejemplo n.º 16
0
        public static void Main()
        {
            try
            {
                Console.WriteLine(CalcTriangleArea(3, 4, 5));

                Console.WriteLine(NumberToLetters(5));

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

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

                bool horizontal, vertical;
                Console.WriteLine(CalcDistance(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));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        private 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.PrintAsAbsoluteNumber(1.3);
            Methods.PrintAsPercentage(0.75);
            Methods.PrintAsRightAlignedNumber(2.30);

            bool horizontal, vertical;
            double sideA = 3;
            double sideB = -1;
            double sideC = 3;
            double sideD = 2.5;
            Console.WriteLine(Methods.CalcDistance(sideA, sideB, sideC, sideD));
            Methods.CheckHorizontal(sideA, sideC, out horizontal);
            Methods.CheckVertical(sideB, sideD, out vertical);
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

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

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

            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 18
0
        static void Main()
        {
            var area = CalcTriangleArea(3, 4, 5);
            Console.WriteLine(area);

            var textNumber = NumberToWord(5);
            Console.WriteLine(textNumber);

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

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

            bool horizontal, vertical;
            Console.WriteLine(CalcDistance(3, -1, 3, 2.5, out horizontal, out vertical));
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

            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");

            Console.WriteLine("{0} older than {1} -> {2}",
                peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 19
0
        private static void Main()
        {
            var triangleArea = MathExtensions.CalculateTriangleArea(3, 4, 5);

            Console.WriteLine(triangleArea);

            Console.WriteLine(MathExtensions.GetDigitAsWord(5));

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

            Console.WriteLine(MathExtensions.FormatNumber(1.3, "f"));
            Console.WriteLine(MathExtensions.FormatNumber(0.75, "%"));
            Console.WriteLine(MathExtensions.FormatNumber(2.30, "r"));

            var pointA = new Point(3, -1);
            var pointB = new Point(3, 2.5);

            bool isHorizontal = MathExtensions.IsHorizontal(pointA, pointB);
            bool isVertical   = MathExtensions.IsVertical(pointA, pointB);

            Console.WriteLine("Horizontal? " + isHorizontal);
            Console.WriteLine("Vertical? " + isVertical);

            Student peter  = new Student("Peter", "Ivanov", 21);
            Student stella = new Student("Stella", "Markova", 18);

            Console.WriteLine(
                "{0} older than {1} -> {2}",
                peter.FirstName,
                stella.FirstName,
                peter.IsOlderThan(stella));
        }
Ejemplo n.º 20
0
        static void Main()
        {
            Console.WriteLine(Calculations.CalcTriangleArea(3, 4, 5));

            Console.WriteLine(Formating.ConvertNumbersIntoWords(5));

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

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

            Console.WriteLine(Calculations.CalcDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + Calculations.isHorizontal(2, 1.2));
            Console.WriteLine("Vertical? " + Calculations.isVertical(1, 4.5));

            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));
        }
Ejemplo n.º 21
0
        static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(DigitToText(5));

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

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

            Console.WriteLine(CalcDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + IsHorisontal(-1, 2.5));
            Console.WriteLine("Vertical? " + IsVertical(3, 3));

            Student peter = new Student()
            {
                FirstName = "Peter", LastName = "Ivanov"
            };

            peter.DayOfBirth = DateTime.Parse("17.03.1992");

            Student stella = new Student()
            {
                FirstName = "Stella", LastName = "Markova"
            };

            stella.DayOfBirth = DateTime.Parse("03.11.1993");

            Console.WriteLine("{0} older than {1} -> {2}",
                              peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 22
0
        /// <summary>
        ///
        /// </summary>
        static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(NumberToDigit(5));

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

            FormatNumber(1.3, "f");
            Numbers.Numbers.PrintToPercentageNumber(0.75, "%");
            FormatNumber(2.30, "r");

            bool horizontal, vertical;

            Console.WriteLine(CalcDistance(3, -1, 3, 2.5, out horizontal, out vertical));
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

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

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

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

            Console.WriteLine(NumberToDigit(5));

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

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

            Console.WriteLine(CalcDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + ArePointsHorizontal(1, 2.2, 3, 4.5));
            Console.WriteLine("Vertical? " + ArePointsVertical(1.44, 2.05, 1.44, 4.5));

            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));
        }
Ejemplo n.º 24
0
        public static void Main()
        {
            Console.WriteLine(ExtensionMethods.CalcTriangleArea(3, 4, 5));

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

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

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

            bool horizontal, vertical;
            Console.WriteLine(ExtensionMethods.CalcDistance(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",
                OtherInfo = "From Sofia, born at 17.03.1992"
            };

            Student stella = new Student
            {
                FirstName = "Stella",
                LastName = "Markova",
                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));
        }
Ejemplo n.º 25
0
        static void Main()
        {
            //StatisticUtils Tests
            Console.WriteLine("StatisticUtils Tests");
            Console.WriteLine("The Max of the numbers '5, -1, 3, 2, 14, 2, 3' is :{0}", StatisticUtils.Max(5, -1, 3, 2, 14, 2, 3));
            Console.WriteLine();

            //StringUtils Tests
            Console.WriteLine("StringUtils Tests");
            Console.WriteLine("The digit 5 to string is: {0}", StringUtils.DigitToString(5));
            Console.WriteLine("Different Formats");
            Console.WriteLine(StringUtils.FormatNumber(1.3, "f"));
            Console.WriteLine(StringUtils.FormatNumber(0.75, "%"));
            Console.WriteLine(StringUtils.FormatNumber(2.30, "r"));
            Console.WriteLine();

            //GeometryUtils Tests
            Console.WriteLine("GeometryUtils Tests");
            Console.WriteLine("Trinagle with sides '3,4,5' has area: {0}", GeometryUtils.CalcTriangleArea(3, 4, 5));
            Console.WriteLine("Distance between the two lines is: {0}", GeometryUtils.CalcDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + GeometryUtils.IsHorizontalLine(3, -1, 3.0, 2.5));
            Console.WriteLine("Vertical? " + GeometryUtils.IsVerticalLine(3, -1, 3.0, 2.5));
            Console.WriteLine();

            //Student Tests
            Console.WriteLine("Student Tests");
            Student peter = new Student(firstName: "Peter", lastName: "Ivanov", dateOfBirth: "17/03/1992");
            peter.OtherInfo = "From Sofia.";

            Student stella = new Student(firstName: "Stella", lastName:"Markova", dateOfBirth: "03/11/1993");
            stella.OtherInfo = "From Vidin, gamer, high results.";

            Console.WriteLine("{0} older than {1} -> {2}",
                peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 26
0
        public static void Main()
        {
            Console.WriteLine("--- Test GraphicUtils library ---");
            Console.WriteLine("Tiangle Area (a=3, b=4, c=5) = {0}", GraphicUtils.CalcTriangleArea(3, 4, 5));
            double pointOneX = 3;
            double pointOneY = -1;
            double pointTwoX = 3;
            double pointTwoY = 2.5;
            Console.WriteLine("Distance betwenn A({0}, {1}) & B({2}, {3}) = {4}",
                pointOneX, pointOneY, pointTwoX, pointTwoY, GraphicUtils.CalculateDistance(pointOneX, pointOneY, pointTwoX, pointTwoY));
            Console.WriteLine("y1 and y2 are on the same line horizontaly: " + GraphicUtils.IsHorizontal(pointOneY, pointTwoY));
            Console.WriteLine("x1 and x2 are on the same line verticaly: " + GraphicUtils.IsVertical(pointOneX, pointTwoX));

            Console.WriteLine("\n--- Test NumberUtils library ---");
            int wordNumber = 5;
            int[] someNumbers = { 5, -1, 3, 2, 14, 2, 3 };
            float formatingNumber = 1.3f;
            Console.WriteLine("Number {0} is: {1}", wordNumber, NumberUtils.ConvertSingleDigitToWord(wordNumber));
            Console.WriteLine("Max number between {0} is: {1}",
                string.Join(", ", someNumbers), NumberUtils.FindMaxNumber(someNumbers));
            Console.WriteLine("{0} foramted as float with 2 digits afer decimal point: {1}",
                formatingNumber, NumberUtils.FormatNumber(formatingNumber, NumberUtils.OutputFormat.Float));
            Console.WriteLine("{0} foramted as percentage: {1}",
                formatingNumber, NumberUtils.FormatNumber(formatingNumber, NumberUtils.OutputFormat.Percentage));
            Console.WriteLine("{0} foramted with 8 positions for number - right alligned: {1}",
                formatingNumber, NumberUtils.FormatNumber(formatingNumber, NumberUtils.OutputFormat.Normal));

            Console.WriteLine("\n--- Test Person object ---");
            var peter = new Student("Peter", "Ivanov", "Sofia", new DateTime(1992, 3, 23));
            var stella = new Student("Stella", "Markova", "Vidin", new DateTime(1993, 11, 3), "gender female");
            Console.WriteLine("{0} is older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
            Console.ReadKey();
        }
Ejemplo n.º 27
0
        public static void Main()
        {
            Console.WriteLine(GeometryUtils.CalcTriangleArea(3, 4, 5));

            Console.WriteLine(TranslatorUtils.ConvertDigitToText(5));

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

            PrinterUtils.PrintAsNumber(1.3, 2);
            PrinterUtils.PrintAsPercent(0.75, 2);
            PrinterUtils.PrintAligned(2.30, 10);

            double distanceBetweenTwoPoints = GeometryUtils.CalcDistance(3, -1, 3, 2.5);
            bool   isHorizontal             = GeometryUtils.IsLineHorizontal(3, 3);
            bool   isVertical = GeometryUtils.IsLineVertical(-1, 2.5);

            Console.WriteLine(distanceBetweenTwoPoints);
            Console.WriteLine("Horizontal? " + isHorizontal);
            Console.WriteLine("Vertical? " + isVertical);

            Student peter = new Student("Peter", "Ivanov", new DateTime(1990, 10, 21), "[N/A]", "Football player");

            Student stella = new Student("Stella", "Markova", new DateTime(1988, 10, 27), "Vidin", "gamer");

            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName,
                              stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 28
0
        public static void Main()
        {
            try
            {
                Console.WriteLine(CalculationTriangleArea(3, 4, 5));
                Console.WriteLine(ConvertNumberToDigit(5));
                Console.WriteLine(FindMaxElementOfArray(5, -1, 3, 2, 14, 2, 3));
                Console.WriteLine();
                PrintAsNumberInSpecialFormat(1.3, "f");
                PrintAsNumberInSpecialFormat(0.75, "%");
                PrintAsNumberInSpecialFormat(2.30, "r");
                Console.WriteLine();
                var peter = new Student("Peter", "Ivanov", "From Sofia, born at 17.03.1992");
                var stella = new Student("Stella", "Markova", "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.WriteLine();
                bool horizontal, vertical;
                Console.WriteLine(CalculationDistance(3, -1, 5, 2.5, out horizontal, out vertical));
                Console.WriteLine("Horizontal? " + horizontal);
                Console.WriteLine("Vertical? " + vertical);
            }
            catch (ArgumentNullException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (InvalidOperationException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 29
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.PrintAsNumber(1.3, "f");
            Methods.PrintAsNumber(0.75, "%");
            Methods.PrintAsNumber(2.30, "r");

            bool horizontal, vertical;

            Console.WriteLine(Methods.CalcDistance(3, -1, 3, 2.5, out horizontal, out vertical));
            Console.WriteLine("Horizontal? {0}", horizontal ? "true" : "false");
            Console.WriteLine("Vertical? {0}", vertical ? "true" : "false");

            var peter = new Student
            {
                FirstName = "Peter",
                LastName  = "Ivanov",
                OtherInfo = "From Sofia, born at 17.03.1992"
            };

            var stella = new Student
            {
                FirstName = "Stella",
                LastName  = "Markova",
                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) ? "true" : "false");
        }
Ejemplo n.º 30
0
        private static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(DigitToStringRepresentation(5));

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

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

            bool horizontal, vertical;

            Console.WriteLine(CalcDistance(3, -1, 3, 2.5, out horizontal, out vertical));
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

            var peter = new Student
            {
                FirstName  = "Peter",
                LastName   = "Ivanov",
                StudentBio = "From Sofia, born at 17.03.1992"
            };

            var stella = new Student
            {
                FirstName  = "Stella",
                LastName   = "Markova",
                StudentBio = "From Vidin, gamer, high results, born at 03.11.1993"
            };

            Console.WriteLine("{0} older than {1} -> {2}",
                              peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 31
0
        private static void Main()
        {
            Console.WriteLine(MathUtilities.CalculateTriangleArea(3, 4, 5));

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

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

            PrintNumberUtilities.PrintNumberWithTwoDecimalPlaces(1.3);

            PrintNumberUtilities.PrintNumberAsPercentage(0.75);

            PrintNumberUtilities.PrintNumberWithEightSpacecInfront(2.30);

            Console.WriteLine(MathUtilities.CalculateDistance(3, -1, 3, 2.5));

            bool horizontal = MathUtilities.IsHorizontal(-1, 2.5);
            bool vertical = MathUtilities.IsVertical(3, 3);
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

            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");
            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 32
0
        public static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(DigitToString(5));

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

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

            double x1 = 3;
            double y1 = -1;
            double x2 = 3;
            double y2 = 2.5;

            Console.WriteLine(CalcDistance(x1, y1, x2, y2));

            bool isHorizontal = AreEqual(y1, y2);
            bool isVertical = AreEqual(y1, y2);

            Console.WriteLine("Horizontal? " + isHorizontal);
            Console.WriteLine("Vertical? " + isVertical);

            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));
        }
Ejemplo n.º 33
0
        public 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, OutoutFormatType.FixedPoint);
            PrintAsNumber(0.75, OutoutFormatType.Percent);
            PrintAsNumber(2.30, OutoutFormatType.RoundTrip);

            double firstPointX  = 3;
            double firstPointY  = -1;
            double secondPointX = 3;
            double secondPointY = 2.5;

            Console.WriteLine(CalcDistance(firstPointX,
                                           firstPointY,
                                           secondPointX,
                                           secondPointY));

            // not coz I see any reason to be made but have it so i`ll keep it
            Console.WriteLine("Horizontal? " + (firstPointY == secondPointY));
            Console.WriteLine("Vertical? " + (firstPointX == secondPointX));

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

            Console.WriteLine("{0} older than {1} -> {2}",
                              peter.FirstName,
                              stella.FirstName,
                              peter.IsOlderThan(stella));
        }
Ejemplo n.º 34
0
        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");

            bool horizontal, vertical;

            Console.WriteLine(CalcDistance(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));
        }
Ejemplo n.º 35
0
        static void Main()
        {
            Console.WriteLine(Methods.CalcTriangleArea(3, 4, 5));

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

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

            Methods.PrintDoubleWithTwoDigit(1.3);
            Methods.PrintDoubleWithPrecent(0.75);
            Methods.PrintDoubleAligned(2.30);

            Console.WriteLine(Methods.CalcDistanceBetweenPoints(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + Methods.IsHorizontalLine(3, -1, 3, 2.5));
            Console.WriteLine("Vertical? " + Methods.IsVerticalLine(3, -1, 3, 2.5));

            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));
        }
Ejemplo n.º 36
0
        static void Main()
        {
            Console.WriteLine(Methods.CalculateTriangleArea(3, 4, 5));
            Console.WriteLine(Methods.DigitToString(5));
            Console.WriteLine(Methods.FindMax(5, -1, 3, 2, 14, 2, 3));

            Methods.PrintAsFixedPoint(1.3);
            Methods.PrintAsPercent(0.75);
            Methods.PrintRightWithAlignmentEight(2.30);

            Point p1 = new Point(3, -1);
            Point p2 = new Point(3, 2.5);

            Console.WriteLine("Distance: " + Methods.CalculateDistanceBetweenTwoPoints(p1, p2));
            Console.WriteLine("Horizontal? " + Methods.IsSomeLineHorizontal(p1, p2));
            Console.WriteLine("Vertical? " + Methods.IsSomeLineVertical(p1, p2));

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

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

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

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

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

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

            bool horizontal = Methods.IsLineHorizontal(-1, 2.5);
            bool vertical = Methods.IsLineVertical(3, 3);

            Console.WriteLine(Methods.CalculateDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

            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} {1} older than {2} {3} -> {4}",
                peter.FirstName,
                peter.LastName,
                stella.FirstName,
                stella.LastName,
                peter.IsOlderThan(stella));
        }
Ejemplo n.º 38
0
        public static void Main()
        {
            Console.WriteLine(CalculateTriangleArea(3, 4, 5));

            Console.WriteLine(GetDigitEnglishWord(5));

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

            PrintFormatNumber(1.3, "f");
            PrintFormatNumber(0.75, "%");

            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));
        }
Ejemplo n.º 39
0
        static void Main()
        {
            Console.WriteLine(CalculateTriangleArea(3, 4, 5));

            Console.WriteLine(DigitAsWord(9));

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

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


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

            bool horizontal, vertical;

            CheckOrientation(3, -1, 3, 2.5, out horizontal, out vertical);
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

            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");

            Console.WriteLine("{0} older than {1} -> {2}",
                              peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 40
0
        public static void Main()
        {
            Console.WriteLine(MathUtils.CalcTriangleArea(3, 4, 5));

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

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

            Methods.FormatNumber(1.3, "f");
            Methods.FormatNumber(0.75, "%");
            Methods.FormatNumber(2.30, "r");

            Console.WriteLine(MathUtils.CalcDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + MathUtils.CheckIfHorizontal(-1, 2.5));
            Console.WriteLine("Vertical? " + MathUtils.CheckIfVertical(3, 3));

            Student peter = new Student
            {
                FirstName = "Peter",
                LastName  = "Ivanov",
                OtherInfo = "From Sofia, born at 17.03.1992"
            };

            Student stella = new Student
            {
                FirstName = "Stella",
                LastName  = "Markova",
                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));
        }
        private static void Main()
        {
            Console.WriteLine(Methods.CalcTriangleArea(3, 4, 5));

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

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

            Methods.PrintNumberFormat(1.3, "f");
            Methods.PrintNumberFormat(0.75, "%");
            Methods.PrintNumberFormat(2.30, "r");

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

            bool horizontal, vertical;

            Methods.CheckLinesPosition(3, -1, 3, 2.5, out horizontal, out vertical);
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

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

            Console.WriteLine("{0} older than {1} -> {2}",
                              peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 42
0
        static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(NumbersZeroToNineWord(5));

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

            PrintAsFloat(1.3);
            PrintAsPercentage(0.75);
            PrintWithSpacesBefore(2.30);

            Console.WriteLine(CalcDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + IsHorizaontal(3,3));
            Console.WriteLine("Vertical? " + IsVertical(-1,2.5));

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

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

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

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

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

            Methods.PrintNumber(1.3, "f");
            Methods.PrintNumber(0.75, "%");
            Methods.PrintNumber(2.30, "r");

            double x1 = 3;
            double y1 = -1;
            double x2 = 3;
            double y2 = 2.5;

            bool horizontal = Methods.ArePointsVertical(x1, x2);
            bool vertical = Methods.ArePointsHorizontal(y1, y2);
            Console.WriteLine(Methods.CalculateDistanceBetweenPoints(x1, y1, x2, y2));
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

            Student peter = new Student { FirstName = "Peter", LastName = "Ivanov" };
            peter.Info = "From Sofia, born at 17.03.1992";

            Student stella = new Student { FirstName = "Stella", LastName = "Markova" };
            stella.Info = "From Vidin, gamer, high results, born at 03.11.1993";

            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
        static void Main()
        {
            try
            {
                Console.WriteLine(Triangle.CalcArea(3, 2, 5));
            }
            catch (ArgumentNullException ex)
            {
                Console.Error.WriteLine("Cannot calculate area of triangle! {0}", ex.Message);
            }
            catch (ArgumentException ex)
            {
                Console.Error.WriteLine("Cannot calculate area of triangle! {0}", ex.Message);
            }


            try
            {
                Console.Error.WriteLine(Number.ToDigit(5));
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Console.Error.WriteLine(ex.Message);
            }


            try
            {
                Console.WriteLine(new int[] { 5, -1, 3, 2, 14, 2, 3 }.FindMax());
            }
            catch (ArgumentNullException ex)
            {
                Console.Error.WriteLine(ex.Message);
            }


            Number.PrintWithFixedPoint(1.3);
            Number.PrintAsPercentage(0.75);
            Number.PrintPadded(2.30);


            Line newLine = new Line(3, -1, 3, 2.5);

            Console.WriteLine(Line.CalcLength(newLine)); //can be called both using an instance of Line or by passing 4 points
            Console.WriteLine("Horizontal?: " + Line.IsHorizontal(newLine));
            Console.WriteLine("Vertical?: " + Line.IsVertical(newLine));

            try //Will throw exception if some properties are not valid
            {
                Student peter  = new Student("Petar", "Ivanov", new DateTime(1992, 3, 17), "Sofia");
                Student stella = new Student("Stella", "Markova", new DateTime(1993, 11, 3), "Vidin");

                Console.WriteLine("{0} older than {1} -> {2}",
                                  peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 45
0
        public static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(ConvertDigitToWord(5));

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

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

            Point pointOne = new Point(3, -1);
            Point pointTwo = new Point(3, 2.5);

            bool horizontal = CheckLineBetweenTwoPointsIsHorizontal(pointOne, pointTwo);
            bool vertical = CheckLineBetweenTwoPointsIsVertical(pointOne, pointTwo);

            Console.WriteLine(CalcDistance(pointOne, pointTwo));
            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));
        }
        static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(NumberToDigit(5));

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

            PrintPreciseNumber(1.3);
            PrintPercentageNumber(0.75);
            PrintRightAlignedNumber(2.30);

            bool horizontal = IsLineHorizontal(-1, 2.5);
            bool vertical   = IsLineVertical(3, 3);

            Console.WriteLine(CalcDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + horizontal);
            Console.WriteLine("Vertical? " + vertical);

            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));
        }
Ejemplo n.º 47
0
        /// <summary>
        /// This is Main method.
        /// </summary>
        public static void Main()
        {
            try
            {
                Console.WriteLine("Triangle area = {0}", Calculations.CalcTriangleArea(3, 4, 5));
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }

            try
            {
                Console.WriteLine("The name of digis is {0}", Formatting.NumberToDigit(5));
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }

            try
            {
                Console.WriteLine("The max element of array is {0}", Calculations.FindMax(5, -1, 3, 2, 14, 2, 3));
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }

            Console.WriteLine(Formatting.PrintAsNumber(1.3, "f"));
            Console.WriteLine(Formatting.PrintAsNumber(0.75, "%"));
            Console.WriteLine(Formatting.PrintAsNumber(2.30, "r"));

            Console.WriteLine("The distance between the two points is {0}", Calculations.CalcDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + Calculations.IsHorizontal(3, 3));
            Console.WriteLine("Vertical? " + Calculations.IsVertical(-1, 2.5));

            Student peter = new Student("Peter", "Ivanov");

            peter.AditionalInfo = "From Sofia, born at 17.03.1992";

            Student stella = new Student("Stella", "Markova");

            stella.AditionalInfo = "From Vidin, gamer, high results, born at 03.11.1993";

            try
            {
                Console.WriteLine(
                    "{0} older than {1} -> {2}",
                    peter.FirstName,
                    stella.FirstName,
                    peter.IsOlderThan(stella));
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }
        }
Ejemplo n.º 48
0
        private static void TestStudentClass()
        {
            Student peter = new Student("Peter", "Ivanov", "From Sofia", "17.03.1992");

            Student stella = new Student("Stella", "Markova", "03.11.1993");
            stella.OtherInfo = "From Vidin, gamer, high results";

            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 49
0
        public static void StudentsTests()
        {
            Student peter = new Student("Peter", "Ivanov", "Sofia", new DateTime(1995, 12, 25));
            Student stella = new Student("Stella", "Markova", "Vidin", new DateTime(1992, 01, 17));

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

            Console.WriteLine();
        }
        /// <summary>
        /// The entry point of the application.
        /// </summary>
        public static void Main()
        {
            try
            {
                Console.WriteLine("Triangle area = {0}", Calculations.CalculateTriangleArea(3, 4, 5));
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }

            Console.WriteLine("The name of the digit is: {0}", Formatting.PrintDigitAsWord(5));
            try
            {
                Console.WriteLine("The max element of the array is {0}", Calculations.FindMax(5, -1, 3, 2, 14, 2, 3));
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }

            Console.WriteLine(Formatting.FormatNumber(1.3, "f"));
            Console.WriteLine(Formatting.FormatNumber(0.75, "%"));
            Console.WriteLine(Formatting.FormatNumber(2.30, "r"));

            Console.WriteLine("The distance between the two pints is {0}", Calculations.CalculateDistance(3, -1, 3, 2.5));
            Console.WriteLine("Horizontal? " + Calculations.IsHorizontalLine(3, 3));
            Console.WriteLine("Vertical? " + Calculations.IsVerticalLine(-1, 2.5));

            Student peter = new Student
            {
                FirstName = "Peter",
                LastName = "Ivanov"
            };
            peter.AdditionalInfo = "From Sofia, born at 17.03.1992";

            Student stella = new Student
            {
                FirstName = "Stella",
                LastName = "Markova"
            };
            stella.AdditionalInfo = "From Vidin, gamer, high results, born at 03.11.1993";

            try
            {
                Console.WriteLine(
                    "{0} older than {1} -> {2}",
                    peter.FirstName,
                    stella.FirstName,
                    peter.IsOlderThan(stella));
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
            }
        }
Ejemplo n.º 51
0
        /// <summary>
        /// Main method for the program
        /// </summary>
        public static void Main()
        {
            Console.WriteLine("Triangle area: " + Methods.CalcTriangleArea(3, 4, 5));
            ////Console.WriteLine("Triangle area: " + CalcTriangleArea(3, -4, 5));  // Throws exception
            ////Console.WriteLine("Triangle area: " + CalcTriangleArea(3, 4, 15));  // Throws exception
            Console.WriteLine();

            Console.WriteLine("Digit to string: " + Methods.GetDigitName(5));
            ////Console.WriteLine(DigitToString("Digit to string: " + 'a'));    // Throws exception
            ////Console.WriteLine(DigitToString("Digit to string: " + 52));     // Throws exception
            Console.WriteLine();

            Console.WriteLine("Max element: " + Methods.FindMax(5, -1, 3, 2, 14, 2, 3));
            ////Console.WriteLine("Max element: " + FindMax()); // Throws exception
            Console.WriteLine();

            Console.Write("Formatted number (f): ");
            Methods.PrintFormattedNumber(1.3, 'f');
            Console.Write("Formatted number (%): ");
            Methods.PrintFormattedNumber(0.75, '%');
            Console.Write("Formatted number (r): ");
            Methods.PrintFormattedNumber(2.30, 'r');
            ////Console.Write("Formatted number (f): ");
            ////PrintFormattedNumber(new []{1,2,3,4}, 'f');     // Throws exception
            ////Console.Write("Formatted number (a): ");
            ////PrintFormattedNumber(2.30, 'a');                // Throws exception
            Console.WriteLine();

            Point pointA = new Point(3, -1);
            Point pointB = new Point(3, 2.5);

            bool isHorizontal = Methods.IsHorizontal(pointA, pointB);
            bool isVertical = Methods.IsVertical(pointA, pointB);

            Console.WriteLine("Distance between points: " + Methods.CalcDistance(pointA, pointB));
            ////Console.WriteLine("Distance between points: " + CalcDistance(3, -1, 3, 2.5));   // Deprecated method overload
            Console.WriteLine("Horizontal? " + isHorizontal);
            Console.WriteLine("Vertical? " + isVertical);
            Console.WriteLine();

            Student peter = new Student("Peter", "Ivanov");
            peter.BirthDate = DateTime.Parse("17.03.1992");     // new DateTime(1992, 3, 17);
            peter.OtherInfo = "From Sofia.";

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

            Console.WriteLine("{0}, Birth date: {1}", peter.FirstName, peter.BirthDate.ToShortDateString());
            Console.WriteLine("{0}, Birth date: {1}", stella.FirstName, stella.BirthDate.ToShortDateString());
            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 52
0
        public static void Main()
        {
            double   sideA        = 3;
            double   sideB        = 4;
            double   sideC        = 5;
            Triangle triangle     = new Triangle(sideA, sideB, sideC);
            double   triangleArea = triangle.CalcTriangleArea();

            Console.WriteLine($"Area of triangle is {triangleArea} cm.");
            Console.WriteLine();

            int    numberToConvert = 5;
            string wordOfDigit     = MathMethods.DigitToWord(numberToConvert);

            Console.WriteLine($"Digit \"{numberToConvert}\" write - {wordOfDigit}.");
            Console.WriteLine();

            int[] numbersForComparison = { 5, -1, 3, 2, 14, 2, 3 };
            int   maxNumber            = MathMethods.FindMaxNumber(numbersForComparison);

            Console.WriteLine($"Max number is: {maxNumber}");
            Console.WriteLine();

            Console.WriteLine("Formatted number:");
            Formatter.PrintFormattingNumber(1.3, "f");
            Formatter.PrintFormattingNumber(0.75, "%");
            Formatter.PrintFormattingNumber(2.30, "r");
            Console.WriteLine();

            double x1          = 3;
            double y1          = -1;
            double x2          = 3;
            double y2          = 2.5;
            Point  firstPoint  = new Point(x1, y1);
            Point  secondPoint = new Point(x2, y2);
            double distance    = firstPoint.CalculateDistanceBetweenTwoPoints(secondPoint);

            Console.WriteLine($"Distance between point A{firstPoint} and point B{secondPoint} is: {distance}");
            Console.WriteLine();

            bool isTwoPointsHorizontal = MathMethods.IsHorizontal(y1, y2);
            bool isTwoPointsVertical   = MathMethods.IsVertical(x1, x2);

            Console.WriteLine($"Is y of point A is horizontal of y of point B? {isTwoPointsHorizontal}");
            Console.WriteLine($"Is x of point A is vertical of x of point B? {isTwoPointsVertical}");
            Console.WriteLine();

            string  peterOtherInfo = "From Sofia, born at 17.03.1992";
            Student peter          = new Student("Peter", "Ivanov", peterOtherInfo);

            string  stellaOtherInfo = "From Vidin, gamer, high results, born at 03.11.1993";
            Student stella          = new Student("Stella", "Markova", stellaOtherInfo);

            Console.WriteLine("{0} older than {1} -> {2}",
                              peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 53
0
        private static void StudentClassTests()
        {
            Student peter  = new Student("Peter", "Ivanov", "Sofia", new DateTime(1992, 3, 17));
            Student stella = new Student("Stella", "Markova", "Vidin", new DateTime(1993, 3, 11));

            Console.WriteLine(
                "{0} older than {1} -> {2}",
                peter.ToString(),
                stella.ToString(),
                peter.IsOlderThan(stella));
        }
Ejemplo n.º 54
0
        public static void Main()
        {
            double sideA = 3;
            double sideB = 4;
            double sideC = 5;
            Triangle triangle = new Triangle(sideA, sideB, sideC);
            double triangleArea = triangle.CalcTriangleArea();
            Console.WriteLine($"Area of triangle is {triangleArea} cm.");
            Console.WriteLine();

            int numberToConvert = 5;
            string wordOfDigit = MathMethods.DigitToWord(numberToConvert);
            Console.WriteLine($"Digit \"{numberToConvert}\" write - {wordOfDigit}.");
            Console.WriteLine();

            int[] numbersForComparison = {5, -1, 3, 2, 14, 2, 3};
            int maxNumber = MathMethods.FindMaxNumber(numbersForComparison);
            Console.WriteLine($"Max number is: {maxNumber}");
            Console.WriteLine();

            Console.WriteLine("Formatted number:");
            Formatter.PrintFormattingNumber(1.3, "f");
            Formatter.PrintFormattingNumber(0.75, "%");
            Formatter.PrintFormattingNumber(2.30, "r");
            Console.WriteLine();

            double x1 = 3;
            double y1 = -1;
            double x2 = 3;
            double y2 = 2.5;
            Point firstPoint = new Point(x1, y1);
            Point secondPoint = new Point(x2, y2);
            double distance = firstPoint.CalculateDistanceBetweenTwoPoints(secondPoint);
            Console.WriteLine($"Distance between point A{firstPoint} and point B{secondPoint} is: {distance}");
            Console.WriteLine();

            bool isTwoPointsHorizontal = MathMethods.IsHorizontal(y1, y2);
            bool isTwoPointsVertical = MathMethods.IsVertical(x1, x2);
            Console.WriteLine($"Is y of point A is horizontal of y of point B? {isTwoPointsHorizontal}");
            Console.WriteLine($"Is x of point A is vertical of x of point B? {isTwoPointsVertical}");
            Console.WriteLine();

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

            Console.WriteLine("{0} older than {1} -> {2}",
                peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
        public static void Main()
        {
            Console.Write("The area of the triangle with sides 3, 4 and 5: ");
            Console.WriteLine(GeometricalOperations.CalculateTriangleArea(3, 4, 5));
            Console.WriteLine();

            Console.Write("The English propunciation of the digit 5: ");
            Console.WriteLine(ConversionOperations.DigitToString(5));
            Console.WriteLine();

            Console.Write("The maximum element of 5, -1, 3, 2, 14, 2, 3: ");
            Console.WriteLine(StatisticalOperations.FindMax(5, -1, 3, 2, 14, 2, 3));
            Console.WriteLine();

            Console.Write("The number 1.1251251253 with precision of 5 digits: ");
            ConsolePrinter.PrintNumber(1.1251251253, 5);
            Console.WriteLine();

            Console.Write("The percentage of 52.1: ");
            ConsolePrinter.PrintPercent(52.1, 3);
            Console.WriteLine();

            Console.Write("The aligned string 'I am a string!': ");
            ConsolePrinter.PrintAligned("I am a string!", 20);
            Console.WriteLine();

            Console.Write("The distance between the points (2, 6.2) and (5.21, -3.33): ");
            Console.WriteLine(GeometricalOperations.CalculateDistance(2, 6.2, 5.21, -3.33));
            Console.WriteLine();

            Console.WriteLine("Is the line formed by points (2, 5) and (2, 6) horizontal? -> {0}\n",
                GeometricalOperations.IsHorizontalLine(2, 5, 2, 6));
            
            Console.WriteLine("Is the line formed by points (2, 5) and (2, 6) vertical? -> {0}\n",
                GeometricalOperations.IsVerticalLine(2, 5, 2, 6));
            
            Student peter = new Student("Peter", "Ivanov");
            peter.DateOfBirth = new DateTime(1992, 03, 17);
            peter.BirthTown = "Sofia";
            Console.WriteLine(peter);
            
            Student stella = new Student("Stella", "Markova");
            stella.DateOfBirth = new DateTime(1992, 11, 03);
            stella.BirthTown = "Vidin";
            stella.Hobby = "gamer";
            Console.WriteLine(stella);
            
            Console.WriteLine("Is {0} older than {1}? -> {2}",
                peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 56
0
        static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(DigitToStringName(5));

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

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

            var    testPointOne = new TestPoint(3, -1);
            var    testPointTwo = new TestPoint(3, 2.5);
            double testDistance = CalcDistance(
                testPointOne.CoordX,
                testPointOne.CoordY,
                testPointTwo.CoordX,
                testPointTwo.CoordY
                );
            bool isHorizontal = IsHorizontal(testPointOne.CoordY, testPointTwo.CoordY);
            bool isVertical   = IsVertical(testPointOne.CoordX, testPointTwo.CoordX);

            Console.WriteLine(testDistance);
            Console.WriteLine("Horizontal? " + isHorizontal);
            Console.WriteLine("Vertical? " + isVertical);

            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));
        }
Ejemplo n.º 57
0
        internal static void Main()
        {
            int a = 3;
            int b = 4;
            int c = 5;

            Console.WriteLine("Triangle area: " + CalcTriangleArea(a, b, c));

            int number = 5;

            Console.WriteLine("Number as string digit: " + NumberToDigit(number));

            int[] arr = { 5, -1, 3, 2, 14, 2, 3 };
            Console.WriteLine("Max number in array is: " + FindMax(arr));

            object firstNumber  = 1.3;
            object secondNumber = 0.75;
            object thirdNumber  = 2.30;

            PrintAsFixedPoint(firstNumber);
            PrintAsPercent(secondNumber);
            PrintRightAlign(thirdNumber);

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

            double distance = firstPoint.CalculateDistanceTo(secondPoint);

            Console.WriteLine("Distance between the two points: " + distance);

            string linePoisition = LinePosition(firstPoint, secondPoint);

            Console.WriteLine("Line position: " + linePoisition);

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

            Console.WriteLine(
                "{0} older than {1} -> {2}",
                firstStundent.FirstName,
                secondStudent.FirstName,
                firstStundent.IsOlderThan(secondStudent));
        }
Ejemplo n.º 58
0
        internal static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(NumberToDigit(5));

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

            PrintAsRoundedNumber(1.3);
            PrintAsPercent(0.75);
            PrintRightAligned(2.30);

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

            Student peter = new Student("Peter", "Ivanov", DateTime.Parse("17.03.1992"), "Sofia");
            Student stella = new Student("Stella", "Markova", DateTime.Parse("03.11.1993"), "Vidin");

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

            Console.WriteLine(NumberToDigit(5));

            int[] arr = { 5, -1, 3, 2, 14, 2, 3 };
            Console.WriteLine(FindMax(arr));
            Console.WriteLine("[ " + string.Join(", ", arr) + " ]");

            PrintFormattedNumber(1.3, NumberFormat.Float);
            PrintFormattedNumber(0.75, NumberFormat.Percent);
            PrintFormattedNumber(2.30, NumberFormat.PaddedRight);

            double pointOneX = 3;
            double pointOneY = -1;
            double pointTwoX = 3;
            double pointTwoY = 2.5;

            Console.WriteLine("Distance: " + CalculateDistance(pointOneX, pointOneY, pointTwoX, pointTwoY));
            Console.WriteLine("Horizontal? " + (pointOneX.Equals(pointTwoX)));
            Console.WriteLine("Vertical? " + (pointOneY.Equals(pointTwoY)));

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

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

            Console.WriteLine(
                "{0} older than {1} -> {2}",
                peter.FirstName,
                stella.FirstName,
                peter.IsOlderThan(stella));
        }
Ejemplo n.º 60
0
        static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));
            Console.WriteLine(NumberToDigit(5));
            Console.WriteLine(FindMaxNumber(5, -1, 3, 2, 14, 2, 3));

            PrintAsNumber(1.3);
            PrintAsPercent(0.75);
            PrintRightAlignedNumber(2.30);

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

            Student peter = new Student("Peter", "Ivanov", "From Sofia", "1/03/1992 14:00:00");

            Student stella = new Student("Stella", "Markova", "From Vidin", "03/11/1993 14:00:00");

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