Exemplo n.º 1
0
        public void RemoveStudent(Student s)
        {
            if (s == this.students[this.StudentCount - 1])
            {
                this.students[this.StudentCount--] = null;
                s.RemoveCourse(this);
                return;
            }
            bool notFound = true;

            for (int i = 0; i < this.StudentCount - 1; i++)
            {
                if (s == this.students[i] && notFound)
                {
                    this.students[i] = null;
                    this.StudentCount--;
                    s.RemoveCourse(this);
                    notFound = false;
                }
                if (!notFound)
                {
                    this.students[i] = this.students[i + 1];
                }
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Student stu1  = new Student("191", "Akib ", 4.0F);
            Student stu2  = new Student("182", "Sakib", 3.5F);
            Student stu3  = new Student("112", "Rakib", 3.32F);
            Student stu4  = new Student("101", "Naim", 3.33F);
            Student stu5  = new Student("102", "Siam", 3.0F);
            Student stu6  = new Student("110", "Sajid", 3.55F);
            Student stu7  = new Student("122", "Rayhan", 3.55F);
            Student stu8  = new Student("001", "Ruba", 3.97F);
            Student stu9  = new Student("002", "Shahrair", 3.98F);
            Student stu10 = new Student("115", "Samuel", 3.99F);



            Course cr1 = new Course("CSE10", "Introduction to programming");
            Course cr2 = new Course("CSE111", "JAVA");
            Course cr3 = new Course("CSE1001", "DATABASE ");



            cr1.AddStudent(stu1, stu2, stu9, stu7, stu10);

            cr1.PrintStudent();

            cr1.RemoveStudent(stu6);

            Console.WriteLine(" Remove Student n");

            stu6.PrintCourse();
            cr1.PrintStudent();



            stu3.AddCourse(cr1, cr2, cr3);
            stu3.PrintCourse();

            stu3.RemoveCourse(cr2);
            Console.WriteLine("Remove Course");
            stu3.PrintCourse();
            cr2.PrintStudent();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            ///student part

            var s1 = new Student("Mahfuza", "39398", 3.0F);
            var s2 = new Student("Sharmili ", "19", 3.5F);
            var s3 = new Student("Jui", "1", 3.85F);



            //course part

            var c1 = new Course("CS01", "OOP2");
            var c2 = new Course("CS02", "Compiler Design");
            var c3 = new Course("CS03", "Software Engineering");


            //add and remove part
            c1.AddStudent(s2, s3);

            c1.PrintStudent();

            c1.RemoveStudent(s3);

            Console.WriteLine("\n    After Removing Student  \n");

            s1.PrintCourse();
            c1.PrintStudent();

            Console.WriteLine("\n                   \n");

            s2.AddCourse(c1, c2, c3);
            s2.PrintCourse();

            s2.RemoveCourse(c2);
            Console.WriteLine("\n After Dropping Course \n");
            s2.PrintCourse();
            c2.PrintStudent();
        }