Beispiel #1
0
 public void SaveAnswer(Answer answer)
 {
     manager.SaveAnswer(answer);
 }
Beispiel #2
0
 /// <summary>
 ///  This class performs an important function.
 /// </summary>
 public AnswerWidget CreateAnswerWidget(Answer answer)
 {
     return AnswerWidgetStrategy.ContainsKey(answer.Type)? AnswerWidgetStrategy[answer.Type]
         .Create(answer) : new DefaultAnswerWidgetFactory().Create(answer);
 }
Beispiel #3
0
 public Quiz createSimpleQuiz(String question, String[] answers, int[] correctAnswers)
 {
     string tmp = question;
     string[] answ = answers;
     Question tmpQuestion = new Question();
     tmpQuestion.Value = tmp;
     tmpQuestion.ID = 0;
     tmpQuestion.Type = QuestionType.ONLY_TEXT;
     writeQuestion(tmpQuestion);
     Quiz tmpQuiz = new Quiz();
     tmpQuiz.ID = 0;
     tmpQuiz.LevelID = 0;
     tmpQuiz.QuestionID = 0;
     tmpQuiz.QuestionType = QuestionType.ONLY_TEXT;
     tmpQuiz.TipType = TipType.ONLY_TEXT;
     tmpQuiz.AnswerType = AnswerType.ONLY_TEXT;
     int tmpId = 0;
     foreach (string tmpString in answ)
     {
         tmpQuiz.Answers.Add(tmpId);
         Answer answer = new Answer(tmpId, tmpString, AnswerType.ONLY_TEXT);
         writeAnswer(answer);
         tmpId++;
     }
     foreach (int tmpC in correctAnswers)
     {
         tmpQuiz.CorrectAnswers.Add(tmpC);
     }
     writeQuiz(tmpQuiz);
     return tmpQuiz;
 }
Beispiel #4
0
 public Answer createAnswer()
 {
     Answer tmpAnswer = new Answer(0,"",AnswerType.ONLY_TEXT);
     return tmpAnswer;
 }
Beispiel #5
0
 public void writeAnswer(Answer answer)
 {
     //String tmp = StringSerializer.Serialize<Answer>(answer);
     //FileManager.Save<Answer>(ANSWER_PATH + answer.ID + BASE_EXTENTIONS, answer);
     manager.SaveAnswer(answer);
 }
Beispiel #6
0
 public void init()
 {
     string tmp = "Supponendo che: \n int a = 2; int b = 3; float c = 4; double d = 5; int risI; int e = 2; double risD; \n" +
         "Qual e' risultato dell’espressione seguente?\n" +
         "risD = d + c * b + a / b;";
     string[] answ = {"15","18,5","18"};
     Question tmpQuestion = new Question();
     tmpQuestion.Value = tmp;
     tmpQuestion.ID = 0;
     tmpQuestion.Type = QuestionType.ONLY_TEXT;
     writeQuestion(tmpQuestion);
     Quiz tmpQuiz = new Quiz();
     tmpQuiz.ID = 0;
     tmpQuiz.LevelID = 0;
     tmpQuiz.QuestionID = 0;
     tmpQuiz.QuestionType = QuestionType.ONLY_TEXT;
     tmpQuiz.TipType = TipType.ONLY_TEXT;
     tmpQuiz.AnswerType = AnswerType.ONLY_TEXT;
     int tmpId =0 ;
     foreach (string tmpString in answ)
     {
         tmpQuiz.Answers.Add(tmpId);
         Answer answer = new Answer(tmpId, tmpString, AnswerType.ONLY_TEXT);
         writeAnswer(answer);
         tmpId++;
     }
     tmpQuiz.CorrectAnswers.Add(0);
     writeQuiz(tmpQuiz);
 }
Beispiel #7
0
 public AnswerWidget Create(Answer answer)
 {
     AnswerWidget tmp;
     tmp = new DefaultAsnwerWidget();
     return tmp;
 }