Ejemplo n.º 1
0
        private void AddComponent()
        {
            Console.WriteLine("In which term is this does this component belong to?");
            String temp = Console.ReadLine();

            Term          term    = GetTerm(temp);
            List <Course> courses = term.ListOfCourse;

            Console.WriteLine("Which course is this component for?");
            String courseName = Console.ReadLine().ToLower();

            Course course = GetCourse(courseName, courses);

            Console.WriteLine("What's the name of this component?");
            String componentName = Console.ReadLine();

            Console.WriteLine("What's the weight of this component? (In percentage)");
            String weightString = Console.ReadLine();
            Double weight       = Convert.ToDouble(weightString);

            Component tempComponent = new Component(weight, componentName);

            try
            {
                course.AddComponent(tempComponent);
            }
            catch (PreExistingCompException)
            {
                Console.WriteLine("This component already exists in this course! Please try again...");
            }
            Console.WriteLine("Component has been added!");
            DisplayAssignmentOptions();
            String key = Console.ReadLine().ToUpper();

            Component1 = tempComponent;

            if (key.Equals("K"))
            {
                Process(key);
            }
        }