public static Question CreateSubQuestion(String line) { Question temp = new OneChoice(Constants.MathCourse, 1, Constants.OneChoiceQuestionType, String.Empty, String.Empty); String[] properties = line.Split(Constants.SemiColon); char course = Convert.ToChar(properties[0]); int difficulty = Convert.ToInt32(properties[1]); char questionType = Convert.ToChar(properties[2]); String question = properties[3]; switch (questionType) { case Constants.OneChoiceQuestionType: temp = new OneChoice(course, difficulty, questionType, question, properties[4]); break; case Constants.MultipleChoiceQuestionType: String[] possibleAnswers = new String[5]; bool[] correctAnswers = new bool[5]; for (int i = 0; i <= 4; i++) { possibleAnswers[i] = properties[i + 4]; correctAnswers[i] = Convert.ToBoolean(properties[i + 9]); } temp = new MultipleChoice(course, difficulty, questionType, question, possibleAnswers, correctAnswers); break; case Constants.DragDropQuestionType: String[] dragAnswers = new String[5]; String[] dropAnswers = new String[5]; for (int i = 0; i <= 4; i++) { dragAnswers[i] = properties[i + 4]; dropAnswers[i] = properties[i + 9]; } temp = new DragNDrop(course, difficulty, questionType, question, dragAnswers, dropAnswers); break; case Constants.TableQuestionType: temp = new TableQuestion(course, difficulty, questionType, question, Convert.ToInt32(properties[4])); break; } return temp; }
public OneChoice(OneChoice o) //Copy Constructor : base(o.GetCourse, o.GetDifficulty, o.GetQuestionType, o.GetQuestion) { this.correctAnswer = o.GetCorrectAnswer(); }