示例#1
0
        static void Main(string[] args)
        {
            Quiz myQuiz = new Quiz(new List <Question>());

            List <string> possAns1 = new List <string>()
            {
                "Garfield", "Salem", "Cheshire", "Tom"
            };
            List <int> correctAns1 = new List <int>()
            {
                2, 3
            };
            Checkbox newQuestion1 = new Checkbox(2, "Who is the best cat in the world?", possAns1, correctAns1);

            myQuiz.AddQuestion(newQuestion1);

            List <string> possAns2 = new List <string>()
            {
                "Doc", "Tillie", "Gizmo", "Benji", "Nala"
            };
            MultipleChoice newQuestion2 = new MultipleChoice(1, "Who won the Halloween Costume Contest?", 3, possAns2);

            myQuiz.AddQuestion(newQuestion2);

            TrueOrFalse newQuestion3 = new TrueOrFalse(1, "Are all dogs the best?", true);

            myQuiz.AddQuestion(newQuestion3);

            myQuiz.RunQuiz();

            myQuiz.GradeQuiz();
        }
示例#2
0
        //TESTING TRUE OR FALSE
        public static void Question3()
        {
            TrueOrFalse TFTestQuestion = new TrueOrFalse("In reality, I have no friends.", 'a');

            Console.WriteLine(TFTestQuestion.ToString() + "\n");
            char[] TFchoice = { Console.ReadKey().KeyChar };

            Console.WriteLine("\n" + TFTestQuestion.GradeAnswer(TFchoice) + "\n");
        }
示例#3
0
        static void Main(string[] args)
        {
            Quiz     quiz = new Quiz();
            Question q1   = new MultipleChoice("What is 1+1?", new List <string> {
                "1", "2", "3", "4"
            }, "2");

            quiz.Add(q1);
            Question q2 = new TrueOrFalse("Is 1+1 is 2?", "true");

            quiz.Add(q2);
            Question q3 = new Checkbox("What is 1+1?", new List <string> {
                "1", "2", "Two", "3"
            }, new List <string> {
                "2", "3"
            });

            quiz.Add(q3);
            quiz.Run();
            quiz.Grade();

            /*string option;
             *
             * do
             * {
             *  Console.WriteLine("It's Quiz time.What do you want(Press ENTER to quit)?\n1.Add Question\n2.Run the Quiz\n3.Grade the Quiz");
             *
             *  option = Console.ReadLine();
             *  switch (option)
             *  {
             *      case "1":
             *          Console.WriteLine("Which type of question you want to enter?\n1.Multiple Choice\n2.True/false\n3.Checkbox.");
             *          string questionType = Console.ReadLine();
             *          Console.WriteLine("Enter the QuestionText to add.");
             *          string questionText = Console.ReadLine();
             *          switch (questionType)
             *          {
             *              case "1":
             *                  Console.WriteLine("Enter 4 options seperated by comma");
             *                  List<string> options = Console.ReadLine().Split(",").ToList();
             *                  for (int i = 0; i < 4; i++)
             *                      Console.WriteLine("{0}.{1}", i + 1, options[i]);
             *                  Console.WriteLine("Choose the correct answer option");
             *                  string answer = Console.ReadLine();
             *                  Question q = new MultipleChoice(questionText, options, answer);
             *                  quiz.Add(q);
             *                  break;
             *              case "2":
             *                  Console.WriteLine("enter true/false.");
             *                  break;
             *              case "3":
             *                  break;
             *          }
             *
             *          break;
             *      case "2":
             *          quiz.Run();
             *          break;
             *      case "3":
             *          quiz.Grade();
             *          break;
             *      default:
             *          Console.WriteLine("Choose a valid option.");
             *          break;
             *
             *  }
             * } while (option != "");*/
        }