static void Main(string[] args) { #region Student init Student StudentAlex = new Student("Alex", "Green", "st. Great 16", "st. NotYeat 88", "New York", "State New York", "USA", 880041); Student StudentBob = new Student("Bob", "Ross", "St. Josh 77", "st. michat 28", "Hippostan", "HippoState", "Honduras", 626381); Student StudentAnna = new Student("Anna", "AndAnna", "BlaBlaStreet", "Not great st 8", "Moscow", "StateState2", "Russia", 725630); #endregion #region Teacher init Teacher TeacherKsavier = new Teacher("Professor", "Ksaviet", "Michigan 15", "Kellenoya 23", "Washington DC", "Wash", "AMERICA", 866623); #endregion #region Course init Course ProgrammingInCSharp = new Course(); ProgrammingInCSharp.Name = "Programming in C#"; ProgrammingInCSharp.Credits = "No credits"; ProgrammingInCSharp.DurationInWeeks = 20; ProgrammingInCSharp.Students.Add(StudentAlex); ProgrammingInCSharp.Students.Add(StudentBob); ProgrammingInCSharp.Students.Add(StudentAnna); ProgrammingInCSharp.Teachers.Add(TeacherKsavier); #endregion #region Degree init Degree Bachelor = new Degree(); Bachelor.Name = "Bachelor degree"; Bachelor.CreditsRequired = "No credits required"; Bachelor.Courses = ProgrammingInCSharp; #endregion #region Program init UProgram InformationTechnology = new UProgram(); InformationTechnology.Name = "Information Technology"; InformationTechnology.DepartmentHead = "Alan Turing"; InformationTechnology.Degrees = Bachelor; #endregion #region Info print Console.WriteLine(InformationTechnology.Name + " program contains " + InformationTechnology.Degrees.Name); Console.WriteLine(); Console.WriteLine(InformationTechnology.Degrees.Name + " contains " + InformationTechnology.Degrees.Courses.Name); Console.WriteLine(); Console.WriteLine(InformationTechnology.Degrees.Courses.Name + " contains " + Student.studentsCounter + " student(s)"); #endregion Console.WriteLine(); Console.ReadKey(); }
static void Main(string[] args) { var student1 = new Student(); var student2 = new Student(); var student3 = new Student(); var course = new Course("Programming with C#"); course.AddStudent(student1); course.AddStudent(student2); course.AddStudent(student3); var teacher = new Teacher(); course.AddTeacher(teacher); var degree = new Degree("Bachelor"); degree.AddCourse(course); var uprogram = new UProgram("Information Technology"); uprogram.AddDegree(degree); Console.WriteLine("{0} program contains {1} degree\n", uprogram.ProgramName, uprogram.Degree.Name); Console.WriteLine("{0} degree contains the course {1}\n", uprogram.Degree.Name, uprogram.Degree.Course.CourseName); Console.WriteLine("{0} course contains {1} student(s)\n", uprogram.Degree.Course.CourseName, uprogram.Degree.Course.NumOfStudents); //Checking GradeTest() and TakeTest() methods Person personStudent = new Student(); personStudent.FirstName = "Michael"; personStudent.LastName = "Jordan"; Person personTeacher = new Teacher(); personTeacher.FirstName = "Phil"; personTeacher.LastName = "Jackson"; (personStudent as Student).TakeTest(); (personTeacher as Teacher).GradeTest(); }
static void Main(string[] args) { // Instantiating 3 students: Student st1 = new Student("john"); Student st2 = new Student("barbara"); Student st3 = new Student(); // Instantiating a course with the specified name: Course cs1 = new Course("Programming with C#"); //Adding students to the object course: cs1.St[0] = st1; cs1.St[1] = st2; cs1.St[2] = st3; //Instantiating 3 teacher objects: Teacher TA1 = new Teacher("Smith"); Teacher TA2 = new Teacher("katrine"); Teacher TA3 = new Teacher("Katrine", "Smith"); //Adding teachers to the object course: cs1.Ta[0] = TA1; cs1.Ta[1] = TA2; cs1.Ta[2] = TA3; //Instantiating a Bachelor degree Degree dg = new Degree("Bachelor of Science"); //Adding the instantiated course to the degree dg.Cs = cs1; //Instantiating a university program called IT: UProgram UP = new UProgram("Information Technology"); //Adding the instantiated degree to the university program: UP.Deg = dg; //Outputting the requested data using the Console.WriteLine method: Console.WriteLine("The program name is {0} and it contains the {1} degree.", UP.Name, dg.Name); Console.WriteLine("The {0} degree contains the course {1}.", dg.Name, cs1.Name); Console.WriteLine("The number of students enrolled in the {0} course: {1}.", cs1.Name, Student.GetNumOfStudent()); Console.ReadKey(); }