static void Main(string[] args) { Student student1 = new Student("John", "Doe", new DateTime(1990, 3, 31)); Student student2 = new Student("George", "Lucas", new DateTime(1990, 4, 8)); Student student3 = new Student("Peter", "Parker", new DateTime(1990, 11, 20)); // Populate students grades with a for loop only for demostration purposes for (int i = 0; i < 4; i++) { student1.Grades.Push(10 - i); student2.Grades.Push(10 - i); student3.Grades.Push(10 - i); } Course course1 = new Course("Programming with C#", 40, 16); course1.Students.Add(student1); course1.Students.Add(student2); course1.Students.Add(student3); Teacher teacher1 = new Teacher("Gerardo", "Martinez", new DateTime(1984, 5, 7)); course1.Teachers.Add(teacher1); Degree degree1 = new Degree("Bachelor of Science", 40, course1); UProgram uprogram1 = new UProgram("Information Technology", "Bruce Wayne", degree1); Console.WriteLine("The {0} program contains the {1} degree\n", uprogram1.ProgramName, degree1.DegreeName); Console.WriteLine("The {0} degree contains the course {1}\n", degree1.DegreeName, course1.CourseName); Console.WriteLine("The {0} course contains {1} student(s)", course1.CourseName, Student.StudentCount); Console.WriteLine("The students in the course {0} are:", course1.CourseName); course1.ListStudents(); Console.WriteLine("Press any key to continue"); Console.ReadKey(); }
static void Main(string[] args) { Course c = new Course("Programming with C#"); Student one = new Student("Steven", "Chiang", new DateTime(1992, 6, 23)); Student two = new Student("Wolf", "Wang", new DateTime(1990, 9, 11)); Student three = new Student("Mo", "Li", new DateTime(1991, 4, 15)); Random rnd = new Random(Guid.NewGuid().GetHashCode()); for (int i = 0; i < 5; i++) { one.Grades.Push(rnd.Next(1, 100)); two.Grades.Push(rnd.Next(1, 100)); three.Grades.Push(rnd.Next(1, 100)); } c.students.Add(one); c.students.Add(two); c.students.Add(three); c.teachers.Add(new Teacher("Yu Je", "Li", new DateTime(1992, 6, 23))); c.ListStudents(); }
public void addStudentToList(Student stud) { this.cStuds.Add(stud); }
static void Main(string[] args) { // Instanciate Student var student1 = new Student("Faïza", "Harbi", "*****@*****.**", new DateTime(1982, 3, 6), "797 code Avenue", "Residence bar", "Montpellier", "Hérault", "34070", "FRANCE", 'F', 3.9f, 100.02m, 4); Stack<double> Grades = new Stack<double>(); List<double> g = new List<double>(); var tmp = student1.generateListOfStudGrades(g); Grades = student1.listToStackGrades(Grades); student1.addStudentGrades(Grades); //grades = stud; // Create ArrayList of Student objects var students = new List<Student>(); // instanciate a Course object var crse = new Course("", "", 80, students); // Adds student1 to the ArrayList of Student crse.addStudentToList(student1); // Instanciate Student var student2 = new Student("Julien", "Mazet", "*****@*****.**", new DateTime(1982, 3, 6), "797 code Avenue", "Residence bar", "Montpellier", "Hérault", "34070", "FRANCE", 'F', 3.9f, 100.02m, 4); // Adds student2 to the ArrayList of Student crse.addStudentToList(student2); // Instanciate Student var student3 = new Student("Ivan", "Joule", "*****@*****.**", new DateTime(1982, 9, 24), "2 Main Street", "", "Stropia", "", "0407", "MACEDONIA", 'M', 3.8f, 500.60m, 3); // Adds student3 to the ArrayList of Student crse.addStudentToList(student3); // Instanciate Student var student4 = new Student("Ana", "Blake", "*****@*****.**", new DateTime(1989, 4, 17), "24 Bazinga Road", "Residence Cooper", "Moscow", "", "101000", "RUSSIA", 'F', 3.9f, 300.20m, 3); // Adds student4 to the ArrayList of Student crse.addStudentToList(student4); crse.ListStudents(); int c = Student.Counter; var teacher1 = new Teacher("Julien", "Mazet", "*****@*****.**", new DateTime(1981, 3, 7), "33 Oxford Street", "Building 50", "Cambridge", "MA", "3143", "USA", 'M', "Computer Science DEV204", 80); var teachers = new List<Teacher>(); teachers.Add(teacher1); var course1 = new Course("Programming with C#", "Computer Science DEV204", 80, students); var courses = new List<Course>(); courses.Add(course1); var degree1 = new Degree("Bachelor Of Science", "Computer Science", 80, courses); var degrees = new List<Degree>(); degrees.Add(degree1); var uprogram1 = new UProgram("Information Technology", "Dean Winchester", degrees); WriteProgramInfo(uprogram1, courses); Console.WriteLine("Press a key to continue....."); Console.ReadKey(); }
public void Students(Student student) { _students.Add(student); }