Пример #1
0
        static void Main(string[] args)
        {
            Student student1 = new Student("Aika", "15BD657849", 3.5, "FIT");
            Console.WriteLine(student1);


        }
Пример #2
0
        static void Main(string[] args)
        {

           Student FirstStudent=new Student("Kusmoldaeva", "Akniet", "15BD02053", 4.0 );
            Console.WriteLine(FirstStudent);
            Console.ReadKey();
        }
Пример #3
0
        static void Main(string[] args)
        {
            string name = Console.ReadLine();
            string surname = Console.ReadLine();
            Double gpa = Convert.ToDouble(Console.ReadLine());
            Student information = new Student(name, surname, gpa);

            Console.WriteLine(information);
            Console.ReadKey();
        }
Пример #4
0
        static void Main(string[] args)
        {
            string a, b, c;
            double d;
            Console.WriteLine("How many students you want involve?");
            int count = int.Parse(Console.ReadLine());
            Student[] infor = new Student[count];
            for (int i = 0; i < count; i++)
            {
                try
                {
                    Console.WriteLine("Write the first name");
                    a = Console.ReadLine();
                    Console.WriteLine("Write the second name");
                    b = Console.ReadLine();
                    Console.WriteLine("Write the your id");
                    c = Console.ReadLine();
                    Console.WriteLine("Write the your gpa");
                    d = double.Parse(Console.ReadLine());
                    infor[i] = new Student(a, b, c, d);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    Console.ReadKey();
                }

            }
            Console.WriteLine("Enter 1 to see all list , enter 2 to see gpa only");
            ConsoleKeyInfo button = Console.ReadKey();
            if (button.Key == ConsoleKey.NumPad1)
            {
                for (int i = 0; i < count; i++)
                {
                    Console.WriteLine(infor[i]);
                }
                Console.ReadKey();
            }
            else if(button.Key==ConsoleKey.NumPad2)
            {
                for (int i = 0; i < count; i++)
                {
                    Console.WriteLine("Name : {0} GPA : {1}",infor[i].name,infor[i].GPA);
                }
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("Good buy");
                Console.ReadKey();
            }
        }
Пример #5
0
 static void Main(string[] args)
 {
     Student Student1 = new Student("Sashko", "Nakonechnyi", DateTime.Now, Education.Specialist, 23, 2);
     Console.WriteLine(Student1.ToShortString());
     Console.WriteLine();
     Student1.date = DateTime.Now;
     Student1.groupNum = 199;
     Student1.Date = DateTime.Now;
     Exam[] ex = new Exam[2];
     ex[0] = new Exam("Maths", 5, DateTime.Now);
     ex[1] = new Exam("English", 4, DateTime.Now);
     Student1.AddExams(ex);
     Console.WriteLine(Student1.ToString());
     Console.WriteLine();
     Person p1 = new Person("X", "T", DateTime.Now);
     Person p2 = new Person("X", "T", DateTime.Now);
     Console.WriteLine(p1.Equals(p2));
     Console.WriteLine(p1.GetHashCode());
     Console.WriteLine(p2.GetHashCode());
     Console.WriteLine();
     Student Student2 = new Student("Ivan", "Ivanov", DateTime.Now, Education.Bachelor, 200, 2);
     Student2.AddExams(new Exam("Inforamatics", 3, DateTime.Now), new Exam(), new Exam("OOP",5,DateTime.Now));
     Student2.AddTests(new Test("Physics", true), new Test("Economics", false));
     Console.WriteLine(Student2.ToString());
     Console.WriteLine();
     Console.WriteLine(Student2.person.ToString());
     Console.WriteLine();
     Student Student3 = (Student) Student2.DeepCopy();
     Student2.name = "Sashko";
     Console.WriteLine(Student2.ToShortString());
     Console.WriteLine(Student3.ToShortString());
     Console.WriteLine();
     try
     {
         Student1.groupNum=99;
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
     Console.WriteLine();
     foreach(Exam E in Student2.exams)
         Console.WriteLine(E.ToString());
     foreach (Test T in Student2.testList)
         Console.WriteLine(T.ToString());
     Console.WriteLine();
     foreach (Exam e in Student3.exams)
         if (e.Mark > 3)
             Console.WriteLine(e.ToString());
 }
Пример #6
0
 public object DeepCopy(int groupN, Education Ed)
 {
     Student stud = new Student();
     stud.name = this.name;
     stud.surname = this.surname;
     stud.date = this.date;
     stud.GroupN = groupN;
     stud.Educ = Ed;
     stud.Exams = this.Exams;
     stud.TestList = this.TestList;
     return stud;
 }
Пример #7
0
 public new object DeepCopy()
 {
     Student stud = new Student();
     stud.name = this.name;
     stud.surname = this.surname;
     stud.date = this.date;
     stud.GroupN = this.GroupN;
     stud.Educ = this.Educ;
     stud.Exams = this.Exams;
     stud.TestList = this.TestList;
     return stud;
 }