Example #1
0
        public static void Main()
        {
            try
            {
                School softUni = new School("SoftUni");

                Student student1 = new Student("Test1", "a123", "some details");
                Student student2 = new Student("Test2", "a12");

                Discipline discipline = new Discipline("PHP", 10, "Enter details here");
                discipline.AddStudents(student1, student2);

                Teacher teacher = new Teacher("Angel", "Teacher details");
                teacher.AddDisciplines(discipline, discipline, discipline);
                
                Class classB1 = new Class("B1", "This is class details.");
                classB1.AddStudents(student1, student2);
                classB1.AddTeachers(teacher);

                softUni.AddClasses(classB1);

                Console.WriteLine(softUni);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #2
0
 static void Main(string[] args)
 {
     try
     {
         //test
         School.Number = 50;
         School.Name = "СОУ Драган Драганов";
         //add 2 classes
         Class class1 = new Class("012");
         Class class2 = new Class("035");
         School.NewClass(class1);
         School.NewClass(class2);
         //some Disciplines
         List<Discipline> disciplines1 = new List<Discipline>
             {new Discipline("Nuclear Physics", 1, -1),      //will throw error
              new Discipline("Astrophysics", 1, 2)};
         List<Discipline> disciplines2 = new List<Discipline>
             {new Discipline("Analysis", 2, 1),
              new Discipline("Applied mathematics", 2, 1)};
         List<Discipline> disciplines3 = new List<Discipline>
             {new Discipline("Painting", 1, 3),
              new Discipline("Photography", 1, 3)};
         //some Teachers
         List<Teacher> teachers = new List<Teacher>
             {new Teacher("M. Petrov"),
              new Teacher("L. Borisova"),
              new Teacher("K. Nakov")};
         //some students
         List<Student> students = new List<Student>
             {new Student("Gosho P.", 10),
              new Student("Pesho B.", 10),
              new Student("Sasho K.", 10)};
         List<Student> students2 = new List<Student>
             {new Student("Misho P.", 10),
              new Student("Tosho B.", 10),
              new Student("Rasho K.", 10)};
         //add teachers and students to each class
         class1.AddTeachers(teachers);
         class1.AddStudents(students);
         class2.AddTeachers(teachers);
         class2.AddStudents(students2);
         //add disciplines for each Teacher
         class1.SetOfTeachers[0].AddDisciplines(disciplines1);
         class1.SetOfTeachers[1].AddDisciplines(disciplines2);
         class1.SetOfTeachers[2].AddDisciplines(disciplines3);
         class2.SetOfTeachers[0].AddDisciplines(disciplines1);
         class2.SetOfTeachers[1].AddDisciplines(disciplines2);
         class2.SetOfTeachers[2].AddDisciplines(disciplines3);
     }
     catch (Exception ex)
     {
         // Get stack trace for the exception with source file information
         var stack = new StackTrace(ex, true);
         // Get the top stack frame
         var frame = stack.GetFrame(0);
         // Get the line number from the stack frame
         //var lineNumber = frame.GetFileLineNumber();
         Console.WriteLine(ex.Message + "\n" + frame);
     }
 }
Example #3
0
        static void Main(string[] args)
        {
            School penchoSlaveikov = new School("Pencho Slaveikov");

            Class mathClass = new Class("12A");

            penchoSlaveikov.AddClass(mathClass);
            Class artClass = new Class("12B");

            penchoSlaveikov.AddClass(artClass);

            #region All Students
            Student[] students =
            {
                new Student("Pesho",   1),
                new Student("Minka",   2),
                new Student("Goshko",  3),
                new Student("Stavri",  4),
                new Student("Penka",   5),
                new Student("Slavka",  6),
                new Student("Dimcho",  7),
                new Student("Pencho",  8),
                new Student("Simo",    9),
                new Student("Giga",   10),
                new Student("Aishe",  11),
            };
            #endregion

            #region All Disciplines
            Discipline mathematics = new Discipline("Mathematics", 3, 10);
            Discipline physics     = new Discipline("Physics", 5, 15);
            Discipline geography   = new Discipline("Geography", 2, 8);
            Discipline music       = new Discipline("Music", 3, 6);
            Discipline english     = new Discipline("English", 6, 12);
            Discipline drawing     = new Discipline("Drawing", 2, 4);
            Discipline chemistry   = new Discipline("Chemistry", 4, 8);
            #endregion

            #region All Teachers
            List <Teacher> teachers = new List <Teacher>()
            {
                new Teacher("Georgiev"),
                new Teacher("Minkov"),
                new Teacher("Ivanov"),
                new Teacher("Panaiotoa"),
                new Teacher("Ignatova")
            };
            #endregion

            teachers[0].AddDiscipline(mathematics);
            teachers[0].AddDiscipline(physics);
            teachers[1].AddDiscipline(chemistry);
            teachers[1].AddDiscipline(physics);
            teachers[2].AddDiscipline(english);
            teachers[3].AddDiscipline(geography);
            teachers[4].AddDiscipline(music);
            teachers[4].AddDiscipline(drawing);

            mathClass.AddStudents(new List <Student>()
            {
                students[0], students[1], students[2], students[3], students[4], students[5]
            });

            artClass.AddStudents(new List <Student>()
            {
                students[6], students[7], students[8], students[9], students[10]
            });

            mathClass.AddTeachers(new List <Teacher>()
            {
                teachers[0], teachers[1], teachers[2]
            });
            artClass.AddTeachers(new List <Teacher>()
            {
                teachers[2], teachers[3], teachers[4]
            });

            #region Print on console
            Console.WriteLine("School: " + penchoSlaveikov);
            Console.Write("Classes: ");
            foreach (var clas in penchoSlaveikov.Classes)
            {
                Console.Write(clas + " ");
            }
            Console.WriteLine();

            Console.WriteLine();
            Console.WriteLine("Teachers in " + mathClass.UniqueId + ":");
            foreach (var teacher in mathClass.Teachers)
            {
                Console.WriteLine(teacher + " - teaches: " + teacher.Disciplines);
            }

            Console.WriteLine();
            Console.WriteLine("Teachers in " + artClass.UniqueId + ":");
            foreach (var teacher in artClass.Teachers)
            {
                Console.WriteLine(teacher + " - teaches: " + teacher.Disciplines);
            }

            Console.WriteLine();
            Console.WriteLine("Students in " + mathClass.UniqueId + ":");
            foreach (var student in mathClass.Students)
            {
                Console.WriteLine(student);
            }

            Console.WriteLine();
            Console.WriteLine("Students in " + artClass.UniqueId + ":");
            foreach (var student in artClass.Students)
            {
                Console.WriteLine(student);
            }
            #endregion
        }
Example #4
0
        static void Main()
        {
            //define students
            Student firstStudent = new Student("Ivan Ivanov", 26);

            firstStudent.AddComment("I love school.");
            Student secondStudent = new Student("Kiril Stoianov", 21);

            secondStudent.AddComment("I hate school.");
            Student thirdStudent = new Student("Martin Hristov", 25);

            Student[] allStudents =
            {
                firstStudent,
                secondStudent,
                thirdStudent
            };

            //define disciplines
            Discipline math = new Discipline("Math", 4, 4);

            math.AddComment("This is the hardest discipline, but it's very useful.");
            Discipline biology   = new Discipline("Biology", 2, 2);
            Discipline chemistry = new Discipline("Chemistry", 1, 2);

            chemistry.AddComment("This is the most useless discipline.");
            Discipline[] allDisciplines =
            {
                math,
                biology,
                chemistry
            };

            //define teachers and add disciplines
            Teacher firstTeacher = new Teacher("Nikolai Nikolov");

            firstTeacher.AddDicipline(math);
            firstTeacher.AddDicipline(chemistry);

            Teacher secondTeacher = new Teacher("Silviq Stefanova");

            secondTeacher.AddComment("She's a great teacher.");
            secondTeacher.AddDicipline(biology);

            Teacher[] allTeachers =
            {
                firstTeacher,
                secondTeacher
            };

            //create class
            Class firstClassInSchool = new Class("12A");

            //add students in class
            firstClassInSchool.AddStudents(allStudents);
            //add teachers for class
            firstClassInSchool.AddTeachers(allTeachers);
            Class[] allClasses =
            {
                firstClassInSchool
            };

            //Define school and display information
            School mySchool = new School("1st Math Highschool");

            //display info
            Console.WriteLine("-------{0}-------", mySchool.Name);
            Console.WriteLine();

            Console.WriteLine("---Teachers---");
            foreach (var teacher in allTeachers)
            {
                foreach (var discipline in teacher.AllDiciplines)
                {
                    Console.WriteLine("{0} -> {1}", teacher, discipline);
                }
            }

            Console.WriteLine();

            Console.WriteLine("---Classes---");
            foreach (var schoolClass in allClasses)
            {
                Console.WriteLine(schoolClass);
            }

            Console.WriteLine();

            //Display Comments
            Console.WriteLine("---Comments---");
            foreach (var schoolClass in allClasses)
            {
                schoolClass.ViewComments();
            }

            Console.WriteLine();

            foreach (var student in allStudents)
            {
                student.ViewComments();
            }

            Console.WriteLine();

            foreach (var teacher in allTeachers)
            {
                teacher.ViewComments();
            }

            Console.WriteLine();

            foreach (var discipline in allDisciplines)
            {
                discipline.ViewComments();
            }
        }
        static void Main(string[] args)
        {
            School penchoSlaveikov = new School("Pencho Slaveikov");

            Class mathClass = new Class("12A");
            penchoSlaveikov.AddClass(mathClass);
            Class artClass = new Class("12B");
            penchoSlaveikov.AddClass(artClass);

            #region All Students
            Student[] students = 
            {
                new Student("Pesho", 1),  
                new Student("Minka", 2),
                new Student("Goshko", 3),
                new Student("Stavri", 4),
                new Student("Penka", 5),
                new Student("Slavka", 6),
                new Student("Dimcho", 7),
                new Student("Pencho", 8),
                new Student("Simo", 9),
                new Student("Giga", 10),
                new Student("Aishe", 11),
            };
            #endregion

            #region All Disciplines
            Discipline mathematics = new Discipline("Mathematics", 3, 10);
            Discipline physics = new Discipline("Physics", 5, 15);
            Discipline geography = new Discipline("Geography", 2, 8);
            Discipline music = new Discipline("Music", 3, 6);
            Discipline english = new Discipline("English", 6, 12);
            Discipline drawing = new Discipline("Drawing", 2, 4);
            Discipline chemistry = new Discipline("Chemistry", 4, 8);
            #endregion

            #region All Teachers
            List<Teacher> teachers = new List<Teacher>()
            {
                new Teacher("Georgiev"),
                new Teacher("Minkov"),
                new Teacher("Ivanov"),
                new Teacher("Panaiotoa"),
                new Teacher("Ignatova")
            };
            #endregion

            teachers[0].AddDiscipline(mathematics);
            teachers[0].AddDiscipline(physics);
            teachers[1].AddDiscipline(chemistry);
            teachers[1].AddDiscipline(physics);
            teachers[2].AddDiscipline(english);
            teachers[3].AddDiscipline(geography);
            teachers[4].AddDiscipline(music);
            teachers[4].AddDiscipline(drawing);

            mathClass.AddStudents(new List<Student>() 
            { 
                students[0], students[1], students[2], students[3], students[4], students[5] 
            });

            artClass.AddStudents(new List<Student>() 
            { 
                students[6], students[7], students[8], students[9], students[10] 
            });

            mathClass.AddTeachers(new List<Teacher>() { teachers[0], teachers[1], teachers[2] });
            artClass.AddTeachers(new List<Teacher>() { teachers[2], teachers[3], teachers[4] });

            #region Print on console
            Console.WriteLine("School: " + penchoSlaveikov);
            Console.Write("Classes: ");
            foreach (var clas in penchoSlaveikov.Classes)
            {
                Console.Write(clas + " ");
            }
            Console.WriteLine();

            Console.WriteLine();
            Console.WriteLine("Teachers in " + mathClass.UniqueId + ":");
            foreach (var teacher in mathClass.Teachers)
            {
                Console.WriteLine(teacher + " - teaches: " + teacher.Disciplines);
            }

            Console.WriteLine();
            Console.WriteLine("Teachers in " + artClass.UniqueId + ":");
            foreach (var teacher in artClass.Teachers)
            {
                Console.WriteLine(teacher + " - teaches: " + teacher.Disciplines);
            }

            Console.WriteLine();
            Console.WriteLine("Students in " + mathClass.UniqueId + ":");
            foreach (var student in mathClass.Students)
            {
                Console.WriteLine(student);
            }

            Console.WriteLine();
            Console.WriteLine("Students in " + artClass.UniqueId + ":");
            foreach (var student in artClass.Students)
            {
                Console.WriteLine(student);
            }
            #endregion
        }
Example #6
0
        static void Main()
        {
            //define students
            Student firstStudent = new Student("Ivan Ivanov", 26);
            firstStudent.AddComment("I love school.");
            Student secondStudent = new Student("Kiril Stoianov", 21);
            secondStudent.AddComment("I hate school.");
            Student thirdStudent = new Student("Martin Hristov", 25);
            Student[] allStudents = {
                                       firstStudent,
                                       secondStudent,
                                       thirdStudent
                                   };

            //define disciplines
            Discipline math = new Discipline("Math", 4, 4);
            math.AddComment("This is the hardest discipline, but it's very useful.");
            Discipline biology = new Discipline("Biology", 2, 2);
            Discipline chemistry = new Discipline("Chemistry", 1, 2);
            chemistry.AddComment("This is the most useless discipline.");
            Discipline[] allDisciplines = {
                                              math,
                                              biology,
                                              chemistry
                                          };

            //define teachers and add disciplines
            Teacher firstTeacher = new Teacher("Nikolai Nikolov");
            firstTeacher.AddDicipline(math);
            firstTeacher.AddDicipline(chemistry);

            Teacher secondTeacher = new Teacher("Silviq Stefanova");
            secondTeacher.AddComment("She's a great teacher.");
            secondTeacher.AddDicipline(biology);

            Teacher[] allTeachers = {
                                        firstTeacher,
                                        secondTeacher
                                    };

            //create class
            Class firstClassInSchool = new Class("12A");
            //add students in class
            firstClassInSchool.AddStudents(allStudents);
            //add teachers for class
            firstClassInSchool.AddTeachers(allTeachers);
            Class[] allClasses = {
                                        firstClassInSchool
                                    };

            //Define school and display information
            School mySchool = new School("1st Math Highschool");

            //display info
            Console.WriteLine("-------{0}-------", mySchool.Name);
            Console.WriteLine();

            Console.WriteLine("---Teachers---");
            foreach (var teacher in allTeachers)
            {
                foreach (var discipline in teacher.AllDiciplines)
                {
                    Console.WriteLine("{0} -> {1}", teacher, discipline);
                }
            }

            Console.WriteLine();

            Console.WriteLine("---Classes---");
            foreach (var schoolClass in allClasses)
            {
                Console.WriteLine(schoolClass);
            }

            Console.WriteLine();

            //Display Comments
            Console.WriteLine("---Comments---");
            foreach (var schoolClass in allClasses)
            {
                schoolClass.ViewComments();
            }

            Console.WriteLine();

            foreach (var student in allStudents)
            {
                student.ViewComments();
            }

            Console.WriteLine();

            foreach (var teacher in allTeachers)
            {
                teacher.ViewComments();
            }

            Console.WriteLine();

            foreach (var discipline in allDisciplines)
            {
                discipline.ViewComments();
            }
        }