static void Main(string[] args) { int i,grade; Student s1 = new Student(), s2 = new Student(), s3 = new Student(); Teacher t1 = new Teacher(), t2 = new Teacher(); Course ProgrammingWithCSharp = new Course("Programming with C#"); //set all students' name s1.FirstName = "S1_F"; s2.FirstName = "S2_F"; s3.FirstName = "S3_F"; s1.LastName = "S1_L"; s2.LastName = "S2_L"; s3.LastName = "S3_L"; //set all students' grades s1.EnterGrades(); s2.EnterGrades(); s3.EnterGrades(); //add all student to course class ProgrammingWithCSharp.AddStudent(s1); ProgrammingWithCSharp.AddStudent(s2); ProgrammingWithCSharp.AddStudent(s3); //add two teacher to course class ProgrammingWithCSharp.AddTeacher(t1); ProgrammingWithCSharp.AddTeacher(t2); //add course to degree Degree Bachelor = new Degree("Bachelor"); Bachelor.AddCourse(ProgrammingWithCSharp); //add degree to uprogram UProgram InformationTechnology = new UProgram("Information Technology"); InformationTechnology.AddDegree(Bachelor); //list students' name ProgrammingWithCSharp.ListStudents(); //list all students' grades s1.ListGrades(); s2.ListGrades(); s3.ListGrades(); Console.ReadLine(); }
static void Main(string[] args) { Student student1 = new Student("Diego", "Caridei", new DateTime(1990, 10, 22), "*****@*****.**"); Student student2 = new Student("Michele", "Sannino", new DateTime(1950, 03, 12), "*****@*****.**"); Student student3 = new Student("Sara", "task", new DateTime(1985, 04, 03), "*****@*****.**"); ArrayList students = new ArrayList(); students.Add(student1); students.Add(student2); students.Add(student3); foreach (Student s in students) { for (int i = 0; i < 5; i++) { double grade = i + 5.53; s.addGrade(grade); } } Course course = new Course("Programming with C#", 15); course.addStudent(student1); course.addStudent(student2); course.addStudent(student3); foreach (Student s in students) { s.popGrade(); s.addGrade(10); } foreach (Student s in students) { double grade5 = s.popGrade(); double grade4 = s.popGrade(); s.popGrade(); s.addGrade(0); s.addGrade(grade4); s.addGrade(grade5); } course.listStudents(); Console.ReadKey(); }
// Constructor. public Degree(string dName, int credits, Course course) { this.DegreeName = dName; this.TotalCredits = credits; this.Course = course; }
public void AddCourse(Course c) { course = c; }