示例#1
0
        static void Main(string[] args)
        {
            //Add Categories
            Category Algemeen = new Category("Algemeen");
            Category Muziek   = new Category("Muziek");
            Category Dieren   = new Category("Dieren");

            //Add 4 Questions, 2 with Multiple choice answers
            Question Question1 = new Question()
            {
                Text = "Wie had een hit met het nummer Relax, take it easy?", Answer = "mika", Difficulty = 3, Category = Muziek
            };
            Question Question2 = new Question()
            {
                Text = "Hebben Giraffen een blauwe tong?", Answer = "ja", Difficulty = 2, Category = Dieren
            };

            ChoiceQuestion Question3 = new ChoiceQuestion()
            {
                Text = "Wat voor vorm heeft de aarde", Difficulty = 1, Category = Algemeen
            };

            Question3.addChoice("kubus", false);
            Question3.addChoice("rond", true);
            Question3.addChoice("plat", false);

            ChoiceQuestion Question4 = new ChoiceQuestion()
            {
                Text = "Bij welke temperatuur kookt water?", Difficulty = 3, Category = Algemeen
            };

            Question4.addChoice("25", false);
            Question4.addChoice("50", false);
            Question4.addChoice("75", false);
            Question4.addChoice("100", true);

            //Add Questions to the array
            AllQuestions.Add(Question1);
            AllQuestions.Add(Question2);
            AllQuestions.Add(Question3);
            AllQuestions.Add(Question4);

            //LINQ Sort
            var result = from s in AllQuestions
                         orderby s.Difficulty
                         select s;

            //Foreach sorted question in the var Result
            foreach (Question question in result)
            {
                //Ask a question
                Question.askQuestion(question);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            List<Question> questions = new List<Question>();

            Question first = new Question()
            {
                Difficulty = 1,
                Vraag = "1+1",
                Antwoord = "2"
            };

            ChoiceQuestion second = new ChoiceQuestion()
            {
                Difficulty = 3,
                Vraag = "In which country was the inventor of Java born?"

            };

            second.AddChoice("Australia", false);
            second.AddChoice("Canada", true);
            second.AddChoice("Denmark", false);
            second.AddChoice("United States", false);

            Question third = new Question() {
                Difficulty=2,
                Vraag="10+10",
                Antwoord="20"
            };

            questions.Add(first);
            questions.Add(second);
            questions.Add(third);

            Sortquestions(questions);

            foreach (Question x in questions) {
                Console.WriteLine(x.Difficulty);

            }
            Console.WriteLine("chose difficulty");
           
            int Graad = Convert.ToInt32(Console.ReadLine());


            questions = (from x in questions
                        where x.Difficulty == Graad
                        select x).ToList();

            foreach (Question x in questions) {
                PresentQuestion(x);
            }

        }
示例#3
0
        public static void askQuestion(Question question)
        {
            Console.WriteLine("Vraag " + counter + ":");
            Console.WriteLine(question.Text);

            if (question.GetType() == typeof(ChoiceQuestion))
            {
                ChoiceQuestion choiceQuestion = question as ChoiceQuestion;
                choiceQuestion.display();
            }

            Console.WriteLine("Jouw antwoord: ");

            string response = Console.ReadLine();

            question.checkAnswer(response);
            counter++;
        }
示例#4
0
        static void Main(string[] args)
        {
            Question first = new Question();

            first.SetText("Who was the inventor of Java?");
            first.SetAnswer("James Gosling");
            first.SetCategory("IT");
            first.SetDifficulty(2);
            ChoiceQuestion second = new ChoiceQuestion();

            second.SetText("In which country was the inventor of Java born?");
            second.AddChoice("Australia", false);
            second.AddChoice("Canada", true);
            second.AddChoice("Denmark", false);
            second.AddChoice("United States", false);
            second.SetCategory("IT");
            second.SetDifficulty(1);

            Console.WriteLine("Welke categorie wilt u?");
            first.CategorySorter();

            PresentQuestion(first);
            PresentQuestion(second);
        }