repl.it
@JakeBusse/

C# Quiz V2

C#

No description

fork
loading
Files
  • main.cs
  • main.exe
main.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
using System;

class MainClass {
  public static void Main (string[] args) {
    int score = 0;
    
    // Name
    Console.WriteLine("What is your name?");
    var name = Console.ReadLine();
    Console.WriteLine("Hello " + name + ", are you ready to take this quiz? (Y/N)");
    var startq = Console.ReadLine();
    if (startq.ToUpper() == "Y") {
      Console.WriteLine("Good Luck!\n");
    }
    else if (startq.ToUpper() == "N") {
      Console.WriteLine("Press 'S' when you are ready to begin");
      var startnow = Console.ReadLine();
      if (startnow.ToUpper() == "S") {
        Console.WriteLine("Good Luck!\n");
      }
    }
      else {
       Console.WriteLine("Please select a value within the parameters.");
      }
    }
    
    // Question 1
    Console.WriteLine ("What coding language is this? \n a: CSS \n b: F# \n c: C++ \n d: C#");
    var q1 = Console.ReadLine();
    if (q1.ToUpper() == "D") {
      Console.WriteLine("Correct     +1\n");
      score += 1;
    }
    else {
      Console.WriteLine("Incorrect     +0\n");
    }

    // Question 2
    Console.WriteLine ("T/F: C# is similar to python and java.");
    var q2 = Console.ReadLine();
    if (q2.ToUpper() == "T") {
      Console.WriteLine("Correct     +1\n");
      score += 1;
    }
    else {
      Console.WriteLine("Incorrect     +0\n");
    }

    // Question 3
    Console.WriteLine ("Who designed C#?");
    var q3 = Console.ReadLine();
    if (q3.ToUpper() == "MICROSOFT") {
      Console.WriteLine("Correct     +1\n");
      score += 1;
    }
    else if (q3.ToUpper() == "MICROSOFT CORPORATION") {
      Console.WriteLine("Correct     +1\n");
      score += 1;
    }
    else {
      Console.WriteLine("Incorrect     +0\n");
    }

    // Question 4
    Console.WriteLine ("In what year was C# released?");
    var q4 = Console.ReadLine();
    if (q4 == "2003") {
      Console.WriteLine("Correct     +1\n");
      score += 1;
    }
    else if (q4 == "2002") {
      Console.WriteLine("Correct     +1\n");
      score += 1;
    }
    else {
      Console.WriteLine("Incorrect     +0\n");
    }

        // Question 5
    Console.WriteLine ("How is C# pronounced? \n   a: C Number \n   b: C Sharp \n   c: C C \n   d: None of the Above");
    var q5 = Console.ReadLine();
    if (q5.ToUpper() == "B") {
      Console.WriteLine("Correct     +1\n");
      score += 1;
    }
    else {
      Console.WriteLine("Incorrect     +0\n");
    }
    
    Console.WriteLine("Congratulations, " + name + "! You finished the quiz and got " + score + "/5 Correct.");
    double originalPercentage = score/5.0;
    double finalPercentage = originalPercentage*100;

    if (finalPercentage>=94) {
      // A
      Console.WriteLine("That is a " + finalPercentage + "%");
      Console.WriteLine("That is an A on the grading scale.");
      Console.WriteLine("Great Job!");
    }
    else if (finalPercentage>=90 && finalPercentage<94) {
      // A-
      Console.WriteLine("That is a " + finalPercentage + "%");
      Console.WriteLine("That is an A- on the grading scale.");
      Console.WriteLine("Great Job!");
    }
    else if (finalPercentage>=87 && finalPercentage<90) { 
      // B+
      Console.WriteLine("That is an " + finalPercentage + "%");
      Console.WriteLine("That is a B+ on the grading scale.");
      Console.WriteLine("Good Job!");
    }
    else if (finalPercentage>=83 && finalPercentage<87) {
      // B 
      Console.WriteLine("That is an " + finalPercentage + "%");
      Console.WriteLine("That is a B on the grading scale.");
      Console.WriteLine("Good Job!");
    }
    else if (finalPercentage>=80 && finalPercentage<83) {
      // B-
      Console.WriteLine("That is an " + finalPercentage + "%");
      Console.WriteLine("That is a B- on the grading scale.");
      Console.WriteLine("Good Job!");
    }
    else if (finalPercentage>=77 && finalPercentage<80) {
      // C+
      Console.WriteLine("That is a " + finalPercentage + "%");
      Console.WriteLine("That is a C+ on the grading scale.");
      Console.WriteLine("Better luck next time...");
    }
    else if (finalPercentage>=73 && finalPercentage<77) {
      // C
      Console.WriteLine("That is a " + finalPercentage + "%");
      Console.WriteLine("That is a C on the grading scale.");
      Console.WriteLine("Better luck next time...");
    }
    else if (finalPercentage>=70 && finalPercentage<73) {
      // C-
      Console.WriteLine("That is a " + finalPercentage + "%");
      Console.WriteLine("That is a C- on the grading scale.");
      Console.WriteLine("Better luck next time...");
    }
    else if (finalPercentage>=67 && finalPercentage<70) {
      // D+
      Console.WriteLine("That is a " + finalPercentage + "%");
      Console.WriteLine("That is a D+ on the grading scale.");
      Console.WriteLine("You showed poor understanding of the subject, consider retaking.");
    }
    else if (finalPercentage>=63 && finalPercentage<67) {
      // D
      Console.WriteLine("That is a " + finalPercentage + "%");
      Console.WriteLine("That is a D on the grading scale.");
      Console.WriteLine("You showed poor understanding of the subject, consider retaking.");
    }
    else if (finalPercentage>=60 && finalPercentage<63) {
      // D-
      Console.WriteLine("That is a " + finalPercentage + "%");
      Console.WriteLine("That is a D- on the grading scale.");
      Console.WriteLine("You showed poor understanding of the subject, consider retaking.");
    }
    else if (finalPercentage>=0 && finalPercentage<60) {
      // F
      Console.WriteLine("That is a " + finalPercentage + "%");
      Console.WriteLine("That is an F on the grading scale.");
      Console.WriteLine("You showed poor understanding of the subject, consider retaking.");
    }
  }
}