当前位置: 首页>>代码示例>>C#>>正文


C# Teacher.AddComment方法代码示例

本文整理汇总了C#中Teacher.AddComment方法的典型用法代码示例。如果您正苦于以下问题:C# Teacher.AddComment方法的具体用法?C# Teacher.AddComment怎么用?C# Teacher.AddComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Teacher的用法示例。


在下文中一共展示了Teacher.AddComment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    static void Main(string[] args)
    {
        //We are given a school. In the school there are classes of students. Each class
        //has a set of teachers. Each teacher teaches a set of disciplines. Students have
        //name and unique class number. Classes have unique text identifier. Teachers have
        //name. Disciplines have name, number of lectures and number of exercises. Both teachers
        //and students are people. Students, classes, teachers and disciplines could have optional
        //comments (free text block).
        //Your task is to identify the classes (in terms of  OOP) and their attributes and operations,
        //encapsulate their fields, define the class hierarchy and create a class diagram with Visual Studio.

        //I use this class(class Scool) like a scool.
        try
        {
            //Initialize some students
            Student joro = new Student("Joro", 19877);
            Student petur = new Student("Petur", 19878);
            Student ivo = new Student("Ivo", 19879);

            //...some disciplines
            Discipline math = new Discipline("Mathematic", 8, 5);
            Discipline bio = new Discipline("Biology", 7, 3);

            // ... teacher
            Teacher ivanov = new Teacher("Ivanov");
            //Adding some disciplines that he teaching
            ivanov.SetOfDisciplines.Add(math);
            ivanov.SetOfDisciplines.Add(bio);

            //Make a class with students and teacher
            Class theBestClass = new Class("The best of the best");
            theBestClass.SetOfStudents.Add(joro);
            theBestClass.SetOfStudents.Add(petur);
            theBestClass.SetOfStudents.Add(ivo);
            theBestClass.SetOfTeachers.Add(ivanov);
            Console.WriteLine("Our clas - \"{0}\" have {1} studets :\n{2}and {3} teacher(s) :\n{4}"
                , theBestClass.UniqueTextIdentifier, theBestClass.SetOfStudents.Count, theBestClass.Students()
                , theBestClass.SetOfTeachers.Count, theBestClass.Teachers());

            //Add and show some optional comments
            ivo.AddComment("Ivo is football player");
            ivanov.AddComment("Mr. Ivanov do not like football players.");
            Console.WriteLine(ivo.ShowComment()+","+ivanov.ShowComment());

        }
        catch (Exception ex)
        {

            Console.WriteLine("Error!" + ex.Message); ;
        }
    }
开发者ID:Jarolim,项目名称:TelerikAcademy-1,代码行数:51,代码来源:School(main).cs

示例2: Main

    public static void Main()
    {
        Class myClass = new Class("12 V");

           Teacher firstTeacher = new Teacher("Gesha");
           myClass.AddTeacher(firstTeacher);

           Teacher secondTeacher = new Teacher("Dragan");
           myClass.AddTeacher(secondTeacher);

           Teacher thirdTeacher = new Teacher("Petkan");
           myClass.AddTeacher(thirdTeacher);
           string comment="you mad?";
           thirdTeacher.AddComment(comment);
           Console.WriteLine(thirdTeacher.comments[0]);
           foreach (var teacher in myClass.SetOfTeachers)
           {
               teacher.Name = "something";
               Console.WriteLine(teacher.Name);
           }
    }
开发者ID:peterlambov,项目名称:CSharp,代码行数:21,代码来源:TestSchool.cs

示例3: Main

    public static void Main()
    {
        SchoolClass firstClass = new SchoolClass();

        Teacher firstTeacher = new Teacher("Ivan");
        firstClass.AddTeacher(firstTeacher);

        Teacher secondTeacher = new Teacher("Stoian");
        firstClass.AddTeacher(secondTeacher);

        Teacher thirdTeacher = new Teacher("Dragan");
        firstClass.AddTeacher(thirdTeacher);
        thirdTeacher.AddComment("Test wtf!");

        Console.WriteLine(thirdTeacher.Comments[0]);

        foreach (var teacher in firstClass.SetOfTeachers)
        {
            teacher.Name = "test";
        }
    }
开发者ID:HansS,项目名称:TelerikAcademy-homework,代码行数:21,代码来源:Program.cs

示例4: Main

        static void Main()
        {
            //Instance of a school
            School mySchool = new School("125SOU");
            //Instance of a new teacher
            Teacher teach01 = new Teacher("Antonova");
            //Instance of a new discipline
            Discipline discipl01 = new Discipline(DisciplineName.Arts);
            //Add a discipline to teachers list - during this process you have to mark number of lectures and number of exercises
            teach01.AddDiscipline(discipl01);
            //instance of a new class
            Class myClass = new Class("first B");
            //Add this class to schools list
            mySchool.AddAClassInTheSchool(myClass);

            //Instance of another class - with the same name(identifier) - to check if it unique
            Class anotherClass = new Class("first B");
            //Add another class with the same identifier - the program will warn you and will ask to change this identifier
            mySchool.AddAClassInTheSchool(anotherClass);

            //Instance of a student
            Student stud01 = new Student("Petar");
            //Add this student to first class
            myClass.AddAStudent(stud01); //The program will ask for classnumber and will check if it unique

            //Instance of another student
            Student stud02 = new Student("Vania");
            myClass.AddAStudent(stud02); //Try to give this student the same class number as the first student

            //Add a teacher to a class
            myClass.AddATeacher(teach01);

            //Test adding comments
            mySchool.AddComment();
            teach01.AddComment();
        }
开发者ID:Bonevm01,项目名称:OOP_Principles1,代码行数:36,代码来源:SchoolTest.cs


注:本文中的Teacher.AddComment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。