-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConsoleQuiz.cs
45 lines (34 loc) · 1.14 KB
/
ConsoleQuiz.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
namespace PersonalityQuizTelegram
{
public class ConsoleQuiz : PersonalityQuiz
{
public ConsoleQuiz(Question[] questions, Result[] results) : base(questions, results)
{
if (questions.Length == 0)
{
throw new ArgumentException("Questions can not be 0");
}
if (questions == null || results == null)
{
throw new ArgumentNullException(nameof(questions));
}
}
public string[] RunConsoleQuiz()
{
string[] selections = new string[this.Questions.Length];
int i = 0;
foreach (Question question in this.Questions)
{
Console.WriteLine(question.QuestionField);
foreach (Answer answer in question.Answers)
{
Console.WriteLine(answer.AnswerField);
}
Console.WriteLine("Enter your choice");
selections[i] = Console.ReadLine();
i++;
}
return selections;
}
}
}