Ejemplo n.º 1
0
        public static void Main()
        {
            try
            {
                var subStr = ArrayUtils.Subsequence("Hello!".ToCharArray(), 2, 3);
                Console.WriteLine(subStr);

                var subArr = ArrayUtils.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 2);
                Console.WriteLine(String.Join(" ", subArr));

                var allArr = ArrayUtils.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 4);
                Console.WriteLine(String.Join(" ", allArr));

                var emptyArr = ArrayUtils.Subsequence(new int[] { -1, 3, 2, 1 }, 0, 0);
                Console.WriteLine(String.Join(" ", emptyArr));

                Console.WriteLine(ExtractSubstring.ExtractEnding("I love C#", 2));
                Console.WriteLine(ExtractSubstring.ExtractEnding("Nakov", 4));
                Console.WriteLine(ExtractSubstring.ExtractEnding("beer", 4));
                //Console.WriteLine(ExtractSubstring.ExtractEnding("Hi", 100));

                int number = 23;
                Primes.PrintIsPrime(Primes.CheckPrime(number), number);
                number = 33;
                Primes.PrintIsPrime(Primes.CheckPrime(number), number);

                List<Exam> peterExams = new List<Exam>();
                //{
                //new SimpleMathExam(2),
                //new CSharpExam(55),
                //new CSharpExam(100),
                //new SimpleMathExam(1),
                //new CSharpExam(0),
                //};

                Exam CSharpExam = new CSharpExam(75);
                Student peter = new Student("Peter", "Petrov", peterExams);

                //peter.AddExam(CSharpExam);

                double peterAverageResult = peter.CalcAverageExamResultInPercents();
                Console.WriteLine("Average results = {0:p0}", peterAverageResult);
            }
            catch (ArgumentNullException ex)
            {
                Console.WriteLine("!!! {0}", ex.Message);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine("!!! {0}", ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("!!! {0}", ex.Message);
            }
        }