Beispiel #1
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");

            // Added these examples to prove I call these objects from the main method
            student1.TakeTest();
            teacher1.GradeTest();


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

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

            course1.students[0] = student1;
            course1.students[1] = student2;
            course1.students[2] = student3;

            course1.teachers[0] = teacher1;

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

            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}");
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var students = new[]
            {
                new Student {
                    FirstName = "Petr"
                },
                new Student {
                    FirstName = "Ivan"
                },
                new Student {
                    FirstName = "Igor"
                }
            };
            var course = new Course {
                Name = "Programming with C#", Students = students
            };
            var teacher = new Teacher {
                FirstName = "Nikiphor"
            };

            course.Teachers[0] = teacher;
            var degree = new Degree {
                Name = "Bachelor", Course = course
            };
            var program = new UProgram {
                Name = "Information Technology", Degree = degree
            };

            Console.WriteLine("The {0} program contains the {1} of Science degree", program.Name, program.Degree.Name);
            Console.WriteLine("The {0} of Science degree contains the course {1}", degree.Name, degree.Course.Name);
            Console.WriteLine("The {0} course contains {1} students", course.Name, course.Students.Length);
            Console.WriteLine("Press any key to continue");
            Console.ReadKey();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Student s1 = new Student("Angel", "Munoz", new DateTime(1992, 05, 16), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico");
            Student s2 = new Student("Perla", "Lopez", new DateTime(1992, 12, 10), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico", "Dir2");
            Student s3 = new Student("Victor", "Munoz", new DateTime(1992, 07, 10), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico");
            Student[] students = { s1, s2, s3 };
            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();
            }

            Console.ReadKey();
            
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            //Console.WriteLine("Student Count: {0}.\n",Student.TotalCount);

            var student1 = new Student("Joe", "Smith", new DateTime(1985, 4, 13));
            //Console.WriteLine("Student Count: {0}.\n", Student.TotalCount);

            var student2 = new Student("John", "Doe", new DateTime(1984, 1, 31));
            //Console.WriteLine("Student Count: {0}.\n", Student.TotalCount);

            var student3 = new Student("Jane", "Doe", new DateTime(1988, 9, 22));
            //Console.WriteLine("Student Count: {0}.\n", Student.TotalCount);

            // new Student[] {...} could be just new []{...}
            // but I figured it's good to be explicit for the purpose of the course
            var students = new Student[] { student1, student2, student3 };

            var teacher = new Teacher("\"Uncle\" Bob", "Martin", new DateTime(1948, 10, 8));

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

            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);
        }
Beispiel #5
0
        private static void WriteProgramInfo(UProgram program)
        {
            var degree = program.Degrees.First();

            Console.WriteLine("The {0} program contains the {1} degree.\n", program.Name, degree);

            var course = degree.Courses.First();

            Console.WriteLine("The {0} degree contains the course {1}.\n", degree, course);

            Console.WriteLine("The {0} course has {1} student(s).\n", course, course.Students.Length);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            // 1. Instantiate three Student objects.
            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);

            // 2. Instantiate a Course object called Programming with C#.
            Course course_c_sharp = new Course("Programming with C#", 4);

            Student[] students = new Student[3];
            students[0] = student1;
            students[1] = student2;
            students[2] = 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);

            Teacher[] teachers = new Teacher[1];

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

            // 6. Instantiate a Degree object, such as Bachelor.
            Degree degree = new Degree("Bachelor of Science");

            // 7. Add your Course object to the Degree object.
            degree.Course = course_c_sharp;

            // 8. Instantiate a UProgram object called Information Technology.
            UProgram program = new UProgram("Information Technology", "Universidad Tecnológica de Bolívar");

            // 9. Add the Degree object to the UProgram object.
            program.Degree = degree;

            /* 10. sing Console.WriteLine statements, output the following information to the console window:
             *  The name of the program and the degree it contains
             *  The name of the course in the degree
             *  The count of the number of students in the course.
             *  Your output should look similar to this:
             */

            Console.WriteLine("The {0} program contains the {1} degree", program.Name, program.Degree.Name);
            Console.WriteLine("The {0} degree contains the course {1}", program.Degree.Name, program.Degree.Course.Name);
            Console.WriteLine("The {0} course contains {1} students", program.Degree.Course.Name, Student.Total_students);
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Student student1 = new Student("Ivan", "Ivanov", "Sofia", 1000, "Bulgaria", 12212);
            Student student2 = new Student("Petar", "Petrov", "Sofia", 1000, "Bulgaria", 12213);
            Student student3 = new Student("Todor", "Todorov", "Sofia", 1000, "Bulgaria", 12214);

            Student[] students = { student1, student2, student3 };
            Teacher   teacher1 = new Teacher("Radomir", "Radomirov", "Sofia", 1000, "Bulgaria", 20);

            Teacher[] teachers = { teacher1 };
            Course    course   = new Course("Programming with C#", students, teachers);
            Degree    degree1  = new Degree("Bachelor", course, 120);
            UProgram  programe = new UProgram("Information Technology", degree1);

            Console.WriteLine($"The {programe.ProgramName} program contains the {degree1.DegreeName} of Science degree");
            Console.WriteLine();
            Console.WriteLine($"The {programe.Degree} of Science degree contains the course {course.CourseName}");
            Console.WriteLine();
            Console.WriteLine($"The {course.CourseName} course contains {Student.studentCounter} student<s>");
        }
Beispiel #8
0
        private static void Main()
        {
            // 5.Run the same code in Program.cs from Module 5 to create instances of your classes
            // so that you can setup a single course that is part of a program and a degree path.
            var uProgram = new UProgram("Information Technology")
            {
                Degree = new Degree("Bachelor")
                {
                    Course = new Course("Programming with C#")
                    {
                        Students = new Collection <Student>
                        {
                            new Student("Harry", "Potter", new DateTime(1980, 7, 31)),
                            new Student("Ron", "Weasley", new DateTime(1980, 3, 1)),
                            new Student("Hermione", "Granger", new DateTime(1979, 9, 19))
                        },
                        Teachers = new Collection <Teacher> {
                            new Teacher("Remus", "Lupin", new DateTime(1960, 3, 10))
                        }
                    }
                }
            };

            try
            {
                // 6.Ensure the Console.WriteLine statements you included in Homework 5, still output the correct information.
                Console.WriteLine(uProgram + Environment.NewLine);
                Console.WriteLine(uProgram.Degree + Environment.NewLine);
                Console.WriteLine(uProgram.Degree.Course.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Console.WriteLine("Press any key to continue ...");
                Console.ReadLine();
            }
        }
        static void Main(string[] args)
        {
            Student student1 = new Student("Wang", "Gang", "April 23, 1983");
            Student student2 = new Student("Tony", "Stark", "January 03, 1994");
            Student student3 = new Student("Steve", "Rogers", "July 04, 1920");

            Teacher teacher = new Teacher("Bill", "Gates", "April 05, 1960");

            Course course = new Course("Programming with C#");

            course.addteacher(teacher, 0);
            for (int i = 0; i < 3; i++)
            {
                switch (i)
                {
                case 0:
                    course.addstudent(student1, i);
                    break;

                case 1:
                    course.addstudent(student2, i);
                    break;

                case 2:
                    course.addstudent(student3, i);
                    break;
                }
            }

            Degree degree = new Degree(course, "Bachelor of Science Degree");

            UProgram uprogram = new UProgram(degree, "Information Technology");

            Console.WriteLine("The {0} program contains the {1}", uprogram.name, ((Degree)uprogram.degree).name);
            Console.WriteLine("The {0} contains the course {1}", degree.name, degree.course.courseName);
            Console.WriteLine("The {0} course contains {1} student<s>", course.courseName, course.studentList.Length);
        }
Beispiel #10
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("John", "Doe", "20/Feb/1991", "BD suites", "123 Main Street", "Los Angeles", "Los Angeles", "LA", "123 LA");

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

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

            //Instatianting teacher object
            Teacher t1 = new Teacher("Sarah", "Becks", "20/Apr/1970", "BD suites", "123 Main Street", "Los Angeles", "Los Angeles", "LA", "123 LA");
            Teacher t2 = new Teacher("Joseph", "Zuck", "20/Jun/1950", "BD suites", "123 Main Street", "Los Angeles", "Los Angeles", "LA", "123 LA");

            //adding teachers to Course Object
            c1.addTeacher(t1);
            c1.addTeacher(t2);

            //instatitiating degree object and adding Course Object to degree
            Degree d = new Degree("Bachelor", 400, c1);

            //Instatiating UProgram object
            UProgram p = new UProgram("Information Technology");

            p.addDegree(d);

            //writing console statements
            Console.WriteLine("{0} Program contains {1} degree", p.getProgramName(), p.getDegreeName(d));
            Console.WriteLine("{0} degree contains the {1} course", d.getDegreeName(), d.getCourseName(c1));
            Console.WriteLine("The {0} Course containes {1} student(s)", c1.getCourseName(), c1.countStudents());
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            //Instantiate three Student objects.
            Student[] stArr = new Student[3];
            stArr[0] = new Student("Sophie", "Greene", new DateTime(1982, 12, 1),
                                   "30 Some Street", "", "Leeds", "West Yorkshire", "ZE7 3AE", "UK", 4.0);
            stArr[1] = new Student("Mandy", "Newton", new DateTime(1985, 11, 12),
                                   "30 Some Street", "", "Leeds", "West Yorkshire", "ZE7 3AE", "UK", 3.4);
            stArr[2] = new Student("Sonia", "Cry", new DateTime(1952, 1, 12),
                                   "30 Some Street", "", "Leeds", "West Yorkshire", "ZE7 3AE", "UK", 2.7);

            //Instantiate a Course object called Programming with C#.
            Course[] courses = new Course[1];
            courses[0] = new Course("Programming with C#", 3, 16);

            //Add your three students to this Course object.
            courses[0].Students = stArr;

            //Instantiate at least one Teacher object.
            Teacher[] tchArr = new Teacher[2];
            tchArr[0] = new Teacher("Manual", "Zu", new DateTime(1970, 1, 1), "30 Other Street",
                                    "", "Sheffield", "West Yorkshire", "LE7 9MN", "UK", "Computing");
            tchArr[1] = new Teacher("Handy", "Man", new DateTime(1930, 10, 1), "30 Other Street",
                                    "", "Sheffield", "West Yorkshire", "LE7 9MN", "UK", "Mathmatics");

            //Add that Teacher object to your Course object
            courses[0].Teacher = tchArr;

            //Instantiate a Degree object, such as Bachelor.
            Degree[] deg = new Degree[1];
            deg[0] = new Degree("Bachelor Of Science", 84);

            // Add your Course object to the Degree object.
            deg[0].Courses = courses;

            //Instantiate a UProgram object called Information Technology.
            UProgram prog = new UProgram("Information Technology", "Some One");

            //Add the Degree object to the UProgram object.
            prog.Degrees = deg;

            /*Using Console.WriteLine statements, output the following information to the console window:
             *  The name of the program and the degree it contains
             *  The name of the course in the degree
             *  The count of the number of students in the course.*/
            Console.WriteLine("The {0} program contains the {1}", prog.ProgramName, prog.Degrees[0].Name);
            Console.WriteLine();
            Console.WriteLine("The {0} degree contains the course {1}", prog.Degrees[0].Name, prog.Degrees[0].Courses[0].Name);
            Console.WriteLine();
            Console.WriteLine("The {0} course contains {1} student(s) ", prog.Degrees[0].Courses[0].Name, Student.studentCnt);
            Console.WriteLine();
            prog.Degrees[0].Courses[0].Students[0].takeTest();
            Console.WriteLine();
            prog.Degrees[0].Courses[0].Teacher[1].gradeTest();
            Console.WriteLine();
            prog.Degrees[0].Courses[0].Students[1].takeTest();
            Console.WriteLine();
            prog.Degrees[0].Courses[0].Teacher[0].gradeTest();
            Console.WriteLine();

            #region keep console window open
            Console.Write("Press Any Key to Continue");
            Console.ReadKey();
            Console.Clear();
            #endregion
        }