コード例 #1
0
 static void Main()
 {
     Console.WriteLine("Small Test:");
     Student mara = new Student("Mara", 55);
     Student pesho = new Student("Pesho", 44);
     Teacher joro = new Teacher("Joro");
     Discipline math = new Discipline("Mathematics", 15, 4);
     joro.AddDiscipline(math);
     SchoolClass myClass = new SchoolClass("1a");
     myClass.AddStudent(mara);
     myClass.AddStudent(pesho);
     myClass.AddTeacher(joro);
     Console.WriteLine(myClass);
     try
     {
         SchoolClass myClass2 = new SchoolClass("1a");
     }
     catch (ArgumentException e)
     {
         Console.WriteLine(e.Message);
     }
     try
     {
         Student gosho = new Student("Gosho", 44);
     }
     catch (ArgumentException e)
     {
         Console.WriteLine(e.Message);
     }
 }
コード例 #2
0
        static void Main()
        {
            School mySchool = new School("Telerik Academy");

            // Creating students
            Student[] studentsFirstGroup = new Student[]
            {
                new Student("Georgi Yonchev", 2342032),
                new Student("Stamat Stamatov", 3023224),
                new Student("Pesho Ivanov", 3023434),
                new Student("Georgi Ivanov", 2223434),
                new Student("Mariya Ivanova", 4566434),
                new Student("Pesho Todorov", 2000032)
            };

            Student[] studentsSecondGroup = new Student[]
            {
                new Student("Georgi Petrov", 1342032),
                new Student("Albenoa Kalinova", 2333224),
                new Student("Zahari Zahariev", 3023555),
                new Student("Hristo Georgiev", 2234554),
                new Student("Nikoleta Zlatkova", 7765004),
                new Student("Nikoleta Chaneva", 3023100)
            };

            // Creating disciplines
            Discipline cSharp = new Discipline("C Sharp Fundamentals", 30, 30);
            Discipline javaScript = new Discipline("JavaScript Fundamentals", 40, 50);
            Discipline html = new Discipline("HTML5", 12, 13);
            Discipline css = new Discipline("CSS3");

            // Creating teachers
            Teacher teacher1 = new Teacher("Nikolay Kostov");
            Teacher teacher2 = new Teacher("Ivaylo Kenov");
            Teacher teacher3 = new Teacher("Doncho Minkov");
            Teacher teacher4 = new Teacher("Evlogi Hristov");

            teacher1.AddDiscipline(javaScript, html, css);
            teacher2.AddDiscipline(cSharp);
            teacher3.AddDiscipline(html);
            teacher4.AddDiscipline(css);

            // Creating Group classes
            SchoolClass firstGroupClass = new SchoolClass("First Group-morning");
            SchoolClass secondGroupClass = new SchoolClass("Second Group-evening");

            firstGroupClass.AddTeacher(teacher1, teacher2);
            secondGroupClass.AddTeacher(teacher1, teacher3, teacher4);

            firstGroupClass.AddStudent(studentsFirstGroup);
            secondGroupClass.AddStudent(studentsSecondGroup);

            mySchool.AddClass(firstGroupClass);
            mySchool.AddClass(secondGroupClass);
            Console.WriteLine(mySchool);
        }
コード例 #3
0
ファイル: School.cs プロジェクト: ppetkovv/TelerikAcademy
 public void AddClass(SchoolClass newClass)
 {
     if (classesCount == this.classes.Length)
     {
         SchoolClass[] newClasses = new SchoolClass[this.classes.Length * 2];
         for (int i = 0; i < this.classes.Length; i++)
         {
             newClasses[i] = this.classes[i];
         }
         this.classes = newClasses;
     }
     this.classes[classesCount++] = newClass;
 }
コード例 #4
0
        static void Main()
        {
            var school = new School();

            school.AddSchoolClass(new SchoolClass("2A"));
            school.AddSchoolClass(new SchoolClass("3G"));
            SchoolClass clas = new SchoolClass("4A");

            clas.AddTeacher(new Teacher("Ivan Penchev"));
            clas.AddStudent(new Student("Valeri Velinov", 5));
            Console.WriteLine(clas.ClassIdentifier);
            school.Classes.Clear();
            Console.WriteLine(school.Classes);
        }
コード例 #5
0
        static void Main()
        {
            /// Even with empty constructors so defined class functionalitites can be tested
            var newSchoolClass = new SchoolClass();

            Console.WriteLine(newSchoolClass);

            var newStudent = new Student();

            Console.WriteLine(newStudent);

            var newTeacher = new Teacher();

            Console.WriteLine(newTeacher);
        }
コード例 #6
0
ファイル: School.cs プロジェクト: tvmarinov/Homework
        public void AddClass(SchoolClass newClass)
        {
            var check = this.SchoolClasses
                .Where(schoolClass => schoolClass.ID == newClass.ID)
                .Count();

            if (check > 0)
            {
                throw new ArgumentException("Class IDs must be unique");
            }
            else
            {
                this.SchoolClasses.Add(newClass);
            }
        }
コード例 #7
0
        public void AddClass(SchoolClass newClass)
        {
            var check = this.SchoolClasses
                        .Where(schoolClass => schoolClass.ID == newClass.ID)
                        .Count();

            if (check > 0)
            {
                throw new ArgumentException("Class IDs must be unique");
            }
            else
            {
                this.SchoolClasses.Add(newClass);
            }
        }
コード例 #8
0
        static void Main(string[] args)
        {
            var nakovDisciplines = new List <Discipline>
            {
                new Discipline(DisciplineName.Biology, 10, 10),
                new Discipline(DisciplineName.English, 20, 20)
            };

            var kiroDisciplines = new List <Discipline>
            {
                new Discipline(DisciplineName.History, 8, 8),
                new Discipline(DisciplineName.Physics, 6, 6)
            };

            var studentsClassA = new List <Student>
            {
                new Student("Pesho", "Peshov", 5),
                new Student("Gosho", "Goshov", 6),
                new Student("Ivo", "Ivov", 7)
            };

            var studentsClassB = new List <Student>
            {
                new Student("Mariika", "Mariikova", 8),
                new Student("Todorka", "Todorkova", 9),
                new Student("Stoyanka", "Stoyankova", 10)
            };

            var teachers = new List <Teacher>
            {
                new Teacher("Svetlin", "Nakov", nakovDisciplines),
                new Teacher("Kiro", "Kirov", kiroDisciplines)
            };

            var classA = new SchoolClass(teachers, studentsClassA);
            var classB = new SchoolClass(teachers, studentsClassB);

            var school = new School(new List <SchoolClass> {
                classA, classB
            });

            Console.WriteLine(school);
        }
コード例 #9
0
        static void Main()
        {
            List <Discipline> disciplines = new List <Discipline>();

            disciplines.Add(new Discipline(DisciplineType.Geography, 40, 200));
            disciplines.Add(new Discipline(DisciplineType.Mathematics, 20, 80));

            var student1 = new Student("Gosho", "Marinov");
            var student2 = new Student("Pesho", "Atanasov");

            var listOfStudents = new List <Student>();

            listOfStudents.Add(student1);
            listOfStudents.Add(student2);

            var disciplineList1 = new List <DisciplineType>();

            disciplineList1.Add(DisciplineType.Geography);
            disciplineList1.Add(DisciplineType.Literature);

            var disciplineList2 = new List <DisciplineType>();

            disciplineList2.Add(DisciplineType.Mathematics);
            disciplineList2.Add(DisciplineType.Physics);

            var teacher1 = new Teacher("Lublana", "Vasileva", disciplineList1);
            var teacher2 = new Teacher("Pavel", "Ivanov", disciplineList2);

            var teacherList = new List <Teacher>();

            teacherList.Add(teacher1);
            teacherList.Add(teacher2);

            SchoolClass firstSchool = new SchoolClass(new List <Student>(), new List <Teacher>());

            SchoolClass secondSchool = new SchoolClass(listOfStudents, teacherList);

            System.Console.WriteLine(firstSchool);
            System.Console.WriteLine(secondSchool);
        }
コード例 #10
0
        static void Main()
        {
            School school = new School("Telerik Academy");

            SchoolClass class1 = new SchoolClass("On-line");

            school.Classes.Add(class1);

            Student student1 = new Student("Ivan Petrov", "12345");
            Student student2 = new Student("Petar Ivanow", "56789");
            Student student3 = new Student("Vania Stoianova", "34567");

            class1.Students.Add(student1);
            class1.Students.Add(student2);
            class1.Students.Add(student3);

            Discipline course1 = new Discipline("C#Part1", 40, 40);
            Discipline course2 = new Discipline("C#Part2", 40, 40);
            Discipline course3 = new Discipline("C#OOP", 40, 40);

            Teacher teacher1 = new Teacher("Stoian Nikolov");
            Teacher teacher2 = new Teacher("Ivaylo Ivanov");

            teacher1.Disciplines.Add(course1);
            teacher1.Disciplines.Add(course2);
            teacher2.Disciplines.Add(course2);
            teacher2.Disciplines.Add(course3);

            foreach (var course in teacher1.Disciplines)
            {
                Console.WriteLine("Lector: {0}", teacher1.Name);
                Console.WriteLine("Name of course: {0}, lectures: {1}, Exercises: {2}", course.Name, course.NumberOfLectures, course.NumbersOfExercises);
            }

            foreach (var course in teacher2.Disciplines)
            {
                Console.WriteLine("Lector: {0}", teacher2.Name);
                Console.WriteLine("Name of course: {0}, lectures: {1}, Exercises: {2} ", course.Name, course.NumberOfLectures, course.NumbersOfExercises);
            }
        }
コード例 #11
0
 public void AddClass(SchoolClass toAdd)
 {
     this.Classes.Add(toAdd);
 }
コード例 #12
0
 public void AddSchoolClass(SchoolClass newClass)
 {
     this.classesOfStuds.Add(newClass);
 }
コード例 #13
0
 public void RemoveSchoolClass(SchoolClass currentClass)
 {
     this.classesOfStuds.Remove(currentClass);
 }
コード例 #14
0
 public void RemoveClass(SchoolClass schoolClass)
 {
     this.Classes.Remove(schoolClass);
 }
コード例 #15
0
        public static void Main()
        {
            var school = new School("PG Gen. Vl. Zaimov");

            //students
            var ivan   = new Student("Ivan Ivanov", 100011);
            var stoyan = new Student("Stoyan Stoyanov", 100012);
            var dragan = new Student("Dragan Draganov", 200011);
            var pesho  = new Student("Pesho Peshov", 200012);

            //teachers
            var ivo    = new Teacher("Ivaylo Kenov");
            var niki   = new Teacher("Nikolay Kostov");
            var doncho = new Teacher("Doncho Minkov");
            var evlogi = new Teacher("Evlogi Hristov");

            //classes
            var firstClass  = new SchoolClass("100");
            var secondClass = new SchoolClass("200");

            //disciplines
            var geography = new Discipline("Geography", 2, 2);
            var history   = new Discipline("History", 1, 2);
            var biology   = new Discipline("Biology", 3, 1);
            var math      = new Discipline("Math", 3, 2);
            var mpt       = new Discipline("MPT", 1, 3);

            //adding classes to school
            school.AddClass(firstClass);
            school.AddClass(secondClass);

            //adding teachers and students to classes
            firstClass.AddStudents(ivan);
            firstClass.AddStudents(stoyan);
            firstClass.AddTeachers(ivo);
            firstClass.AddTeachers(evlogi);

            secondClass.AddStudents(dragan);
            secondClass.AddStudents(pesho);
            secondClass.AddTeachers(doncho);
            secondClass.AddTeachers(niki);

            //adding disciplines to teachers
            ivo.AddDisciplines(geography);
            niki.AddDisciplines(biology);
            doncho.AddDisciplines(mpt);
            doncho.AddDisciplines(geography);
            ivo.AddDisciplines(history);
            evlogi.AddDisciplines(biology);

            ivan.Comment = "I like geography!";

            doncho.Comment = "Something.";

            geography.Comment = "Surface of Earth......";

            firstClass.Comment = "Advanced.";

            Console.WriteLine("{0, 28}", school);
            Console.WriteLine(new string('*', 40));
            Console.WriteLine("Class identifier: {0}", firstClass);
            Console.WriteLine("\nStudents: \n{0}", firstClass.GetStudents());
            Console.WriteLine("Teachers: \n{0}", firstClass.GetTeachers());
            Console.WriteLine("Teacher's disciplines: ");
            Console.WriteLine("{0}\n{1}", ivo, ivo.GetDisciplines());
            Console.WriteLine("{0}\n{1}", evlogi, evlogi.GetDisciplines());

            Console.WriteLine("Comments:");
            Console.WriteLine("{0}: {1}", ivan.Name, ivan.Comment);
            Console.WriteLine("{0}: {1}", geography.Name, geography.Comment);
        }
コード例 #16
0
 public void AddClass(SchoolClass schoolClass)
 {
     this.schoolClasses.Add(schoolClass);
 }
コード例 #17
0
ファイル: School.cs プロジェクト: antonpopov/TelerikAcademy
 public void AddClass(SchoolClass schoolClass)
 {
     this.schoolClasses.Add(schoolClass);
 }
コード例 #18
0
        public static void Main()
        {
            var school = new School("PG Gen. Vl. Zaimov");

            //students
            var ivan = new Student("Ivan Ivanov", 100011);
            var stoyan = new Student("Stoyan Stoyanov", 100012);
            var dragan = new Student("Dragan Draganov", 200011);
            var pesho = new Student("Pesho Peshov", 200012);

            //teachers
            var ivo = new Teacher("Ivaylo Kenov");
            var niki = new Teacher("Nikolay Kostov");
            var doncho = new Teacher("Doncho Minkov");
            var evlogi = new Teacher("Evlogi Hristov");

            //classes
            var firstClass = new SchoolClass("100");
            var secondClass = new SchoolClass("200");

            //disciplines
            var geography = new Discipline("Geography", 2, 2);
            var history = new Discipline("History", 1, 2);
            var biology = new Discipline("Biology", 3, 1);
            var math = new Discipline("Math", 3, 2);
            var mpt = new Discipline("MPT", 1, 3);

            //adding classes to school
            school.AddClass(firstClass);
            school.AddClass(secondClass);

            //adding teachers and students to classes
            firstClass.AddStudents(ivan);
            firstClass.AddStudents(stoyan);
            firstClass.AddTeachers(ivo);
            firstClass.AddTeachers(evlogi);

            secondClass.AddStudents(dragan);
            secondClass.AddStudents(pesho);
            secondClass.AddTeachers(doncho);
            secondClass.AddTeachers(niki);

            //adding disciplines to teachers
            ivo.AddDisciplines(geography);
            niki.AddDisciplines(biology);
            doncho.AddDisciplines(mpt);
            doncho.AddDisciplines(geography);
            ivo.AddDisciplines(history);
            evlogi.AddDisciplines(biology);

            ivan.Comment = "I like geography!";

            doncho.Comment = "Something.";

            geography.Comment = "Surface of Earth......";

            firstClass.Comment = "Advanced.";

            Console.WriteLine("{0, 28}", school);
            Console.WriteLine(new string('*', 40));
            Console.WriteLine("Class identifier: {0}", firstClass);
            Console.WriteLine("\nStudents: \n{0}", firstClass.GetStudents());
            Console.WriteLine("Teachers: \n{0}", firstClass.GetTeachers());
            Console.WriteLine("Teacher's disciplines: ");
            Console.WriteLine("{0}\n{1}",ivo, ivo.GetDisciplines());
            Console.WriteLine("{0}\n{1}", evlogi, evlogi.GetDisciplines());

            Console.WriteLine("Comments:");
            Console.WriteLine("{0}: {1}", ivan.Name, ivan.Comment);
            Console.WriteLine("{0}: {1}", geography.Name, geography.Comment);
        }