Ejemplo n.º 1
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.º 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
        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));
        }
        public bool IsOlderThan(Student other)
        {
            DateTime firstDate, secondDate;

            if (this.OtherInfo == string.Empty || other.OtherInfo == string.Empty)
            {
                throw new ArgumentException("There is no info for some of the students!");
            }

            try
            {
                firstDate = DateTime.Parse(this.OtherInfo.Substring(this.OtherInfo.Length - 10));
            }
            catch (FormatException)
            {
                throw new ArgumentException("The info for the stdent doesn\'t contain birthdate in valid format!");
            }

            try
            {
                secondDate = DateTime.Parse(other.OtherInfo.Substring(other.OtherInfo.Length - 10));
            }
            catch (FormatException)
            {
                throw new ArgumentException("The info for the other stdent doesn\'t contain birthdate in valid format!");
            }

            bool isOlder = firstDate < secondDate;
            return isOlder;
        }
Ejemplo n.º 5
0
 public bool IsOlderThan(Student other)
 {
     DateTime firstDate = getBirthDate();
     DateTime secondDate = getBirthDate();
     bool isFirstStudentOlder = (firstDate > secondDate);
     return isFirstStudentOlder;
 }
Ejemplo n.º 6
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.º 7
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.º 8
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.º 9
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.º 10
0
        public bool IsOlderThan(Student other)
        {
            if (this.birthDate.Year < MinBirthDateYear || other.birthDate.Year < MinBirthDateYear)
                throw new ArgumentException("Invalid student birthdate. Year must have value " + MinBirthDateYear + " or more.");

            return this.birthDate < other.birthDate;
        }
Ejemplo n.º 11
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));
        }
Ejemplo n.º 12
0
        public static void Main()
        {
            Console.WriteLine("Triangle area: " + TriangleMethods.CalculateTriangleArea(3, 4, 5));

            Console.WriteLine("Number to word translator: " + NumbersMethods.NumberTranslator(5));

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

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

            Console.WriteLine("Distance: " + CartesianSpaceMethods.CalculateDistance(3, 3, -1, 2.5));
            Console.WriteLine("Horizontal? " + CartesianSpaceMethods.HorizontalLineCheck(3, 3));
            Console.WriteLine("Vertical? " + CartesianSpaceMethods.VerticalLineCheck(-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";

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

            return firstDate > secondDate;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Compare the age of this student with another
        /// </summary>
        /// <param name="other">Another student</param>
        /// <returns>True, if this student is older than the second, False otherwise</returns>
        public bool IsOlderThan(Student other)
        {
            DateTime firstDate = ExtractBirthDate(this.OtherInfo);
            DateTime secondDate = ExtractBirthDate(other.OtherInfo);

            return firstDate > secondDate;
        }
Ejemplo n.º 15
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.º 16
0
        public static void Main()
        {
            // Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(SayDigitToEnglishWord(5));

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

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

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

            bool horizontal = CheckIfIsHorizontal(-1, 2.5);
            Console.WriteLine("Horizontal? " + horizontal);

            bool vertical = CheckIfIsVertical(3, 3);
            Console.WriteLine("Vertical? " + vertical);

            Student peter = new Student("Peter", "Ivanov", "From Sofia", "17.03.1992");
            Student stella = new Student("Stella", "Markova", "From Vidin, gamer, high results", "03.11.1993");
            Console.WriteLine("{0} older than {1} -> {2}", peter.FirstName, stella.FirstName, peter.IsOlderThan(stella));
        }
Ejemplo n.º 17
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.º 18
0
 public bool IsOlderThan(Student otherStudent)
 {
     
     DateTime firstDate = DateTime.Parse(this.DateOfBirth);
     DateTime secondDate = DateTime.Parse(otherStudent.DateOfBirth);
     return firstDate > secondDate;
 }
        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.º 20
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.º 21
0
        public bool IsOlderThan(Student other)
        {
            DateTime firstDate = this.ParseDate(this.OtherInfo);
            DateTime secondDate = this.ParseDate(other.OtherInfo);

            return firstDate < secondDate;
        }
Ejemplo n.º 22
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));
        }
        public bool IsOlderThan(Student otherStudent)
        {
            DateTime firstDate = this.DateOfBirth;
            DateTime secondDate = otherStudent.DateOfBirth;

            return firstDate < secondDate;
        }
Ejemplo n.º 24
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));

            return firstDate > secondDate;
        }
Ejemplo n.º 25
0
        static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 2, 5));

            Console.WriteLine(NumberToDigit(5));

            var elements = new int[] {5, -1, 3, 2, 14, 2, 3};

            Console.WriteLine(FindMax(elements));
            Console.WriteLine(string.Join(", ", elements));

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

            bool horizontal, vertical;
            ComparePoints(3, -1, 3, 2.5, out horizontal, out vertical);
            Console.WriteLine(CalcDistance(3, -1, 3, 2.5));
            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.º 26
0
        public static void Main()
        {
            Console.WriteLine(CalcTriangleArea(3, 4, 5));

            Console.WriteLine(DigitToWord(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));

            Student peter = new Student("Peter", "Ivanov", new DateTime(1992, 3, 17))
            {
                OtherInfo = "From Sofia, born at 17.03.1992"
            };

            Student stella = new Student("Stella", "Markova", new DateTime(1993, 11, 3))
            {
                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.º 27
0
        public bool IsOlderThan(Student other)
        {
            DateTime firstBirthDate = this.BirthDate;
            DateTime secondBirthDate = other.BirthDate;

            return firstBirthDate < secondBirthDate;
        }
Ejemplo n.º 28
0
 private DateTime ParseDateFromOtherInfo(Student student)
 {
     string dateAsString =
         student.OtherInfo.Substring(student.OtherInfo.Length - BACKWARD_LENGTH_FOR_DATE_PARSING);
     DateTime date = DateTime.Parse(dateAsString);
     return date;
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Returns if the student is older than another.
 /// </summary>
 /// <param name="other">The other student.</param>
 /// <returns>If older.</returns>
 public bool IsOlderThan(Student other)
 {
     DateTime firstDate = ParseDateFromOtherInfo(this);
     DateTime secondDate = ParseDateFromOtherInfo(other);
     bool isOlder = firstDate > secondDate;
     return isOlder;
 }
Ejemplo n.º 30
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.º 31
0
        public bool IsOlderThan(Student other)
        {
            bool isThisOlder = this.BirthDay < other.BirthDay;

            return(isThisOlder);
        }
Ejemplo n.º 32
0
 public bool IsOlderThan(Student other)
 {
     return(this.GetAge() > other.GetAge());
 }
Ejemplo n.º 33
0
 public bool IsOlderThan(Student other)
 {
     return this.Birthday < other.Birthday;
 }