예제 #1
0
        public static List <KnowledgeByCourse> GenerateInitialKnowledge(List <Knowledge> knowledges, int pct)
        {
            if ((pct > 100) || (pct <= 0))
            {
                Console.Write("Wrong percent of initial knowledge");
            }
            List <KnowledgeByCourse> lkbc = new List <KnowledgeByCourse>();

            for (int i = 1; i <= (int)knowledges.Count * pct / 100; i++)
            {
                Course            c   = null;
                KnowledgeByCourse kbc = new KnowledgeByCourse(knowledges.ElementAt(i), c);
                lkbc.Add(kbc);
            }
            return(lkbc);
        }
예제 #2
0
        public void AddKnowledge(Knowledge knowledge, Course course)
        {
            bool found = false;

            foreach (KnowledgeByCourse k in this.knowledgeSet)
            {
                if (k.Knowledge == knowledge)
                {
                    k.AddCourse(course);
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                KnowledgeByCourse kbc = new KnowledgeByCourse(knowledge, course);
                this.knowledgeSet.Add(kbc);
            }
        }