Example #1
0
        static void Main(string[] args)
        {
            Student st1     = new Student(4);
            var     avgMark = 0.0;

            st1.FullName = "A. J. Pischik";
            try
            {
                st1.Marks[0] = new Mark("math", 7);
                st1.Marks[1] = new Mark("physics", 9);
                st1.Marks[2] = new Mark("chemistry", 8);
                st1.Marks[3] = new Mark("english", 9);
                Console.WriteLine("full name - " + st1.FullName);
                Console.WriteLine("number of subjects = " + st1.Marks.Length);
                foreach (Mark m in st1.Marks)
                {
                    Console.WriteLine("subject - " + m.Subject);
                    Console.WriteLine("mark = " + m.SMark);
                }
                st1.GetAvgMark(out avgMark);
                Console.WriteLine("average mark of the " + st1.FullName + " = " + avgMark);
                st1.ResetAllMarks();
                st1.GetAvgMark(out avgMark);
                Console.WriteLine("average mark of the " + st1.FullName + " = " + avgMark);
            }
            catch (ArgumentOutOfRangeException outOfRange)
            {
                Console.WriteLine("Error: {0}", outOfRange.Message);
            }
            Console.Read();
        }
Example #2
0
        static void Main(string[] args)
        {
            Student s1 = new Student("Artem", 20, 3);

            s1.SetMarks();
            int sum;

            Console.WriteLine("average mark = " + s1.GetAvgMark(out sum));
            Console.WriteLine("sum = " + sum);

            string name;
            int    age;

            s1.GetNameAge(out name, out age);
            Console.WriteLine("name: " + name + " age: " + age);

            Student s2 = new Student();

            s1.CopyRef(ref s2);
            s2.ShowInfo();
            s2.SetNameAge(age: 21);
            s2.SetMarkSubject("z", "z");
            s2.SetMarkValue(0, 0, 0, 0, 0);
            s2.SetNameAge(age: 25);

            Student s3;

            s2.CopyObj(out s3);
            s3.ShowField(5);
        }