public static void Main() { //ILocalCourse v = new LocalCourse("Some", new Teacher("Teach"), "sd"); //ITeacher t = new Teacher("te"); //t.AddCourse(v); CourseFactory factory = new CourseFactory(); ITeacher nakov = factory.CreateTeacher("Nakov"); Console.WriteLine(nakov); nakov.Name = "Svetlin Nakov"; ICourse oop = factory.CreateLocalCourse("OOP", nakov, "Light"); oop.AddTopic("Using Classes and Objects"); oop.AddTopic("Defining Classes"); oop.AddTopic("OOP Principles"); oop.AddTopic("Teamwork"); oop.AddTopic("Exam Preparation"); Console.WriteLine(oop); ICourse html = factory.CreateOffsiteCourse("HTML", nakov, "Plovdiv"); html.AddTopic("Using Classes and Objects"); html.AddTopic("Defining Classes"); html.AddTopic("OOP Principles"); html.AddTopic("Teamwork"); html.AddTopic("Exam Preparation"); Console.WriteLine(html); nakov.AddCourse(oop); nakov.AddCourse(html); Console.WriteLine(nakov); oop.Name = "Object-Oriented Programming"; (oop as ILocalCourse).Lab = "Enterprise"; oop.Teacher = factory.CreateTeacher("George Georgiev"); oop.AddTopic("Practical Exam"); Console.WriteLine(oop); html.Name = "HTML Basics"; (html as IOffsiteCourse).Town = "Varna"; html.Teacher = oop.Teacher; html.AddTopic("Practical Exam"); Console.WriteLine(html); ICourse css = factory.CreateLocalCourse("CSS", null, "Ultimate"); Console.WriteLine(css); }
static void Main() { using (StreamWriter sw = new StreamWriter("../../output.txt")) { CourseFactory f = new CourseFactory(); ITeacher joro = f.CreateTeacher("Joro"); sw.WriteLine(joro); joro.Name = "George"; sw.WriteLine(joro); ILocalCourse php = f.CreateLocalCourse("PHP", joro, "Enterprise"); sw.WriteLine(php); php.AddTopic("Intro PHP"); php.AddTopic("PHP Core"); php.AddTopic("PHP Advanced Topics"); php.AddTopic("PHP Exam"); sw.WriteLine(php); IOffsiteCourse cpp = (new CourseFactory()).CreateOffsiteCourse("C++", joro, "Ultimate"); sw.WriteLine(cpp); cpp.AddTopic("Intro C++"); cpp.AddTopic("C++ Core"); cpp.AddTopic("C++ Advanced Topics"); cpp.AddTopic("C++ Exam"); sw.WriteLine(cpp); joro.AddCourse(cpp); sw.WriteLine(joro); joro.AddCourse(php); joro.AddCourse(cpp); sw.WriteLine(joro); CourseFactory factory = new CourseFactory(); ITeacher nakov = factory.CreateTeacher("Nakov"); sw.WriteLine(nakov); nakov.Name = "Svetlin Nakov"; sw.WriteLine(nakov); ILocalCourse oop = factory.CreateLocalCourse("OOP", null, "Light"); sw.WriteLine(oop); oop.Teacher = nakov; sw.WriteLine(oop); oop.AddTopic("Using Classes and Objects"); oop.AddTopic("Defining Classes"); oop.AddTopic("OOP Principles"); oop.AddTopic("Teamwork"); oop.AddTopic("Exam Preparation"); sw.WriteLine(oop); ICourse html = factory.CreateOffsiteCourse("HTML", nakov, "Plovdiv"); html.AddTopic("Using Classes and Objects"); sw.WriteLine(html); html.AddTopic("Defining Classes"); html.AddTopic("OOP Principles"); sw.WriteLine(html); html.AddTopic("Teamwork"); html.AddTopic("Exam Preparation"); sw.WriteLine(html); nakov.AddCourse(oop); nakov.AddCourse(html); sw.WriteLine(nakov); oop.Name = "Object-Oriented Programming"; (oop as ILocalCourse).Lab = "Enterprise"; oop.Teacher = factory.CreateTeacher("George Georgiev"); oop.AddTopic("Practical Exam"); sw.WriteLine(oop); html.Name = "HTML Basics"; (html as IOffsiteCourse).Town = "Varna"; html.Teacher = oop.Teacher; html.AddTopic("Practical Exam"); sw.WriteLine(html); ICourse css = factory.CreateLocalCourse("CSS", null, "Ultimate"); sw.WriteLine(css); for (int i = 0; i < 2; i++) { joro.AddCourse(oop); joro.AddCourse(oop); joro.AddCourse(css); } sw.WriteLine(joro); php.Name = "PHP Avdanced Course"; ILocalCourse localPhp = (ILocalCourse)php; localPhp.Lab = "The Very Big Lab"; php.Teacher = nakov; php.AddTopic("Final PHP Topic"); sw.WriteLine(php); html.Name = "PHP Avdanced Course"; IOffsiteCourse offsiteHtml = (IOffsiteCourse)html; offsiteHtml.Town = "The Very Big Lab"; html.Teacher = null; html.AddTopic("Final HTML Topic"); sw.WriteLine(html.ToString()); } }