コード例 #1
0
        private void AddAssignment()
        {
            Console.WriteLine("In which term is this does this assignment belong to?");
            String temp = Console.ReadLine();

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

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

            Course           course     = GetCourse(courseName, courses);
            List <Component> components = course.ListOfComponent;

            Console.WriteLine("What component does this assignment fall under?");
            String componentName = Console.ReadLine();

            Component component = GetComponent(componentName, components);

            Console.WriteLine("What's the title of this assignment?");
            String assignName = Console.ReadLine();

            Console.WriteLine("What'd you score on this assignment?");
            Double score = Convert.ToDouble(Console.ReadLine());

            Assignment tempAssign = new Assignment(assignName, score);

            try
            {
                component.AddAssignment(tempAssign);
            }
            catch (PreExistingAssignException)
            {
                Console.WriteLine("This assignment already exists for this component! Please try again");
            }

            Console.WriteLine("Assignment has been added!\nReturning back to your Academic History");
        }