コード例 #1
0
        static void Main(string[] args)
        {
            var teacher = new Teacher("\"Uncle\" Bob", "Martin", new DateTime(1948, 10, 8));

            var cleanCode = new Course("Clean Code 101", "McConnell", "42A", new[] { teacher });

            var joe  = new Student("Joe", "Smith", new DateTime(1985, 4, 13));
            var john = new Student("John", "Doe", new DateTime(1984, 1, 31));
            var jane = new Student("Jane", "Doe", new DateTime(1988, 9, 22));

            cleanCode.Students.Add(joe);
            cleanCode.Students.Add(john);
            cleanCode.Students.Add(jane);

            foreach (Student student in cleanCode.Students)
            {
                AssignRandomGrades(student);
            }

            var compSci = new Degree("Computer Science", DegreeType.Bachelor);

            compSci.Courses.Add(cleanCode);

            var program = new UProgram("Information Technology", 30.5m);

            program.Degrees.Add(compSci);

            WriteProgramInfo(program);

            cleanCode.ListStudents();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Student student1 = new Student("Fred", "Flintstone", "9/30/1960", "301 Cobblestone Way", "", "Bedrock", "LA", "70777", "USA");
            Student student2 = new Student("Barney", "Rubble", "9/30/1960", "301 Cobblestone Way", "", "Bedrock", "LA", "70777", "USA");
            Student student3 = new Student("Wilma", "Flintstone", "9/30/1960", "301 Cobblestone Way", "", "Bedrock", "LA", "70777", "USA");

            student1.Grades.Push(75);
            student1.Grades.Push(80);
            student1.Grades.Push(99);
            student1.Grades.Push(100);
            student1.Grades.Push(98);

            student2.Grades.Push(77);
            student2.Grades.Push(78);
            student2.Grades.Push(79);
            student2.Grades.Push(80);
            student2.Grades.Push(81);

            student3.Grades.Push(90);
            student3.Grades.Push(85);
            student3.Grades.Push(80);
            student3.Grades.Push(75);
            student3.Grades.Push(70);

            Course course = new Course("Programming with C#");  /* Grading criteria 3 of 4 */

            course.Student.Add(student1);
            course.Student.Add(student2);
            course.Student.Add(student3);

            course.ListStudents();

            Console.WriteLine("Press any key to continue . . .");
            Console.ReadKey();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: AngelMunoz/edXCSModules
        static void Main(string[] args)
        {
            ArrayList students = new ArrayList(); // new empty arraylist
            //student 1
            Student s1 = new Student("Angel", "Munoz", new DateTime(1992, 05, 16), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico");
            s1.Grades = new Stack<int>(5);
            s1.Grades.Push(10);
            s1.Grades.Push(9);
            s1.Grades.Push(8);
            s1.Grades.Push(9);
            s1.Grades.Push(8);
            // student 2
            Student s2 = new Student("Perla", "Lopez", new DateTime(1992, 12, 10), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico", "Dir2");
            s2.Grades = new Stack<int>(5);
            s2.Grades.Push(8);
            s2.Grades.Push(9);
            s2.Grades.Push(8);
            s2.Grades.Push(9);
            s2.Grades.Push(10);
            // student 3
            Student s3 = new Student("Victor", "Munoz", new DateTime(1992, 07, 10), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico");
            s3.Grades = new Stack<int>(5);
            s3.Grades.Push(9);
            s3.Grades.Push(9);
            s3.Grades.Push(8);
            s3.Grades.Push(9);
            s3.Grades.Push(8);
            // add students to the arraylist
            students.Add(s1);
            students.Add(s2);
            students.Add(s3);
            //teachers
            Teacher t1 = new Teacher("Dora", "Rivero", new DateTime(1980, 05, 16), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico");
            Teacher t2 = new Teacher("Ricardo", "Trejo", new DateTime(1981, 03, 19), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico", "Dir2");
            Teacher t3 = new Teacher("Victor", "Arellanes", new DateTime(1980, 05, 10), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico");
            Teacher[] teachers = { t1, t2, t3 };

            Course PCS = new Course("Programming with C#", 15, 6, teachers, students);
            Course PFS = new Course("Programming with F#", 12, 7, teachers, students);
            Course PJ = new Course("Programming with Java", 15, 5, teachers, students);
            Course[] courses = { PCS, PFS, PJ };
            Degree bachelor = new Degree("Bachelor", 500, courses);
            UProgram uprogram = new UProgram("Information Technology", "Mike Perez", bachelor);
            Console.WriteLine("Program: {0}\nDegree: {1}", uprogram.PName, uprogram.Degree.Name);
            Console.WriteLine("Course:{0}\nStudents in Course: {1}", uprogram.Degree.Courses[0].CName, Student.StudentAmt);
            foreach(Student student in PCS.Students)
            {
                student.TakeTest();
            }
            foreach (Teacher teacher in PCS.Teachers)
            {
                teacher.GradeTest();
            }
            PCS.ListStudents();
            Console.ReadKey();
            
        }
コード例 #4
0
        public static void Main(string[] args)
        {
            Student student1 = new Student("Richard", "VanSickle", new DateTime(1986, 3, 10), "169 Saxony Rd", "#212", "Encinitas", "CA", "92024", "USA", "A12245", 3.95);
            Student student2 = new Student("Bob", "Smith", new DateTime(1975, 5, 11), "123 Main St", "", "Pleasantville", "CA", "92123", "USA", "A15826", 2.33);
            Student student3 = new Student("Mary", "Jones", new DateTime(1991, 7, 22), "17 South St", "#246", "San Diego", "CA", "90007", "USA", "B00506", 3.10);

            Course course1 = new Course("Programming with C#", 5, 12);

            Teacher teacher1 = new Teacher("Professor", "Longhair", new DateTime(1946, 3, 15), "19 Hollow Rd", "", "New Orleans", "LA", "70056", "USA", new DateTime(1986, 5, 10), 45457, "C Major");

            Degree degree1 = new Degree("Bachelor of Science", 132);

            UProgram uProgram1 = new UProgram("Computer Science", "Sandy Beach");

            // Adding the arraylist

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

            course1.teachers[0] = teacher1;

            degree1.course   = course1;
            uProgram1.degree = degree1;

            // Inputting the scores for each student

            foreach (Student stu in course1.Students)
            {
                Console.WriteLine($"Enter the grades for {stu.PFirstName} {stu.PLastName}");
                for (int i = 1; i < 6; i++)
                {
                    Console.Write($"Enter grade {i.ToString()}: ");
                    stu.Grades.Push(EnterGrades());
                }
            }

            // Printing out the results

            course1.ListStudents();

            //Console.WriteLine($"The {uProgram1.ProgramName} program contains the {uProgram1.degree.DegreeType} degree");
            //Console.WriteLine($"The {uProgram1.degree.DegreeType} degree contains the course {uProgram1.degree.course.CourseName}");
            //Console.WriteLine($"The {uProgram1.degree.course.CourseName} course contains {Student.studentCount} students");
        }
コード例 #5
0
        static void Main(string[] args)
        {
            Student student1 = new Student("Santiago", "Mendoza", "Manga", 21);
            Student student2 = new Student("Ruben", "Melo", "Torices", 23);
            Student student3 = new Student("Cesar", "De la Hoz", "Cartagena", 24);

            student1.Grades.Push(5);
            student1.Grades.Push(4);
            student1.Grades.Push(3);
            student1.Grades.Push(4);
            student1.Grades.Push(5);
            student2.Grades.Push(4);
            student2.Grades.Push(2);
            student2.Grades.Push(3);
            student2.Grades.Push(2);
            student2.Grades.Push(4);
            student3.Grades.Push(3);
            student3.Grades.Push(2);
            student3.Grades.Push(1);
            student3.Grades.Push(1);
            student3.Grades.Push(1);

            Course course_c_sharp = new Course("Programming with C#", 4);

            ArrayList students = new ArrayList();

            students.Add(student1);
            students.Add(student2);
            students.Add(student3);

            // 3. Add your three students to this Course object.
            course_c_sharp.Students = students;

            // 4. Instantiate at least one Teacher object.
            Teacher   teacher  = new Teacher("Jairo", "Serrano", "Ternera", 30);
            ArrayList teachers = new ArrayList();

            teachers.Add(teacher);

            // 5. Add that Teacher object to your Course object
            course_c_sharp.Teachers = teachers;

            course_c_sharp.ListStudents();
            Console.ReadKey();
        }
コード例 #6
0
        public static void Main(string[] args)
        {
            //Instatiating 3 student objects
            Student s1 = new Student("John", "Doe", "20/Feb/1992", "BB suites", "123 Main Street", "New York", "New York", "USA", "123 NY");
            Student s2 = new Student("Musoke", "Joseph", "14/Feb/1990", "Makerere University", "P.O Box 7062 Kampala, Uganda", "Kampala", "Wakiso", "Uganda", "7062 KLA");
            Student s3 = new Student("Kasibante", "Geoffrey", "20/Feb/1991", "BD suites", "123 Main Street", "Los Angeles", "Los Angeles", "LA", "123 LA");


            //Addding scores to student 1
            s1.addScore(51.2);
            s1.addScore(61.0);
            s1.addScore(71.1);
            s1.addScore(81.1);
            s1.addScore(81.1);
            //Adding scores to student 2
            s2.addScore(52.2);
            s2.addScore(72.0);
            s2.addScore(82.2);
            s2.addScore(62.2);
            s2.addScore(52.2);
            //Adding scores to student 3
            s2.addScore(53);
            s2.addScore(73.3);
            s2.addScore(83.3);
            s2.addScore(63.3);
            s2.addScore(53.3);

            //Instatiating Course object
            Course c1 = new Course("Programming With CSharp");

            //Adding students to Course Object
            c1.addStudent(s1);
            c1.addStudent(s2);
            c1.addStudent(s3);

            //List students
            c1.ListStudents();
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: alban316/edxCSharp
        static void Main(string[] args)
        {
            Student student1 = new Student("Fred", "Flintstone", "9/30/1960", "301 Cobblestone Way", "", "Bedrock", "LA", "70777", "USA");
            Student student2 = new Student("Barney", "Rubble", "9/30/1960", "301 Cobblestone Way", "", "Bedrock", "LA", "70777", "USA");
            Student student3 = new Student("Wilma", "Flintstone", "9/30/1960", "301 Cobblestone Way", "", "Bedrock", "LA", "70777", "USA");

            student1.Grades.Push(75);
            student1.Grades.Push(80);
            student1.Grades.Push(99);
            student1.Grades.Push(100);
            student1.Grades.Push(98);

            student2.Grades.Push(77);
            student2.Grades.Push(78);
            student2.Grades.Push(79);
            student2.Grades.Push(80);
            student2.Grades.Push(81);

            student3.Grades.Push(90);
            student3.Grades.Push(85);
            student3.Grades.Push(80);
            student3.Grades.Push(75);
            student3.Grades.Push(70);

            Course course = new Course("Programming with C#");
            course.Student.Add(student1);                           /* Grading criteria 3 of 5 - Add 3 students using ArrayList method */
            course.Student.Add(student2);
            course.Student.Add(student3);

            course.ListStudents();

            Console.WriteLine("Press any key to continue . . .");
            Console.ReadKey();
        }