-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.cs
56 lines (54 loc) · 1.59 KB
/
Test.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
46
47
48
49
50
51
52
53
54
55
56
public class Test
{
public string Name{get;set;}
public List<String[]> Questions{get;set;}
public int PassingPercentage{get;set;}
public Test(string name, List<string[]> questions, int passingPercentage)
{
Name = name;
Questions = questions;
PassingPercentage = passingPercentage;
}
public string PrintQuestions(int n)
{
Console.WriteLine($"{n}) {Questions[n][0]}");
var javoblar = Questions[n][2..];
for (var i = 0; i < javoblar.Length; i++)
{
Console.WriteLine($"{((EOption) (i+65)).ToString()} = {javoblar[i]}");
}
Console.WriteLine($" ----- Javob kiriting -----");
return Console.ReadLine();
}
public void TakeTest()
{
List<string> Javoblari = new List<string>();
int togrilari = 0;
for (var i = 0; i < Questions.Count; i++)
{
Javoblari.Add(PrintQuestions(i));
}
for (var i = 0; i < Javoblari.Count; i++)
{
var togriJavob = Questions[i][1];
if(togriJavob == Javoblari[i])
{
togrilari++;
}
}
Console.Clear();
if(togrilari>0)
{
Console.WriteLine($"Siz {togrilari} ta to'g'ri topdingiz uraa..");
if((Questions.Count/PassingPercentage) < togrilari)
{
Console.WriteLine(@$"---------- Barakalla --------- ");
}
}
else
{
Console.Clear();
Console.WriteLine($"Bittaham topmadingiz! ");
}
}
}