86 lines
2.7 KiB
C#
86 lines
2.7 KiB
C#
static void ass6()
|
||
{
|
||
var grades = new Dictionary<String, String>
|
||
{
|
||
{"A", "Excellent - outstanding performance with only minor errors"},
|
||
{"B", "Very good – above the average standard but with some errors" },
|
||
{"C", "Good– generally sound work with a number of notable errors" },
|
||
{"D", "Satisfactory – fair but with significant shortcomings" },
|
||
{"E", "Sufficient – performance meets the minimum criteria" },
|
||
{"Fx", "Fail – some more work required before the credit can be awarded" },
|
||
{"F", "Fail - considerable further work is required" }
|
||
};
|
||
|
||
bool inputIsG = false;
|
||
|
||
Console.Write("Write your grade in [");
|
||
foreach (var item in grades)
|
||
{
|
||
Console.Write(" " + item.Key);
|
||
}
|
||
Console.Write(" ]\n Type \"G\" to exit\n");
|
||
|
||
while (!inputIsG)
|
||
{
|
||
String input = Console.ReadLine();
|
||
|
||
if (grades.ContainsKey(input))
|
||
{
|
||
Console.WriteLine(grades[input]);
|
||
}
|
||
else if (input == "G")
|
||
{
|
||
inputIsG = true;
|
||
}
|
||
else
|
||
{
|
||
Console.WriteLine("Invalid input, try again");
|
||
}
|
||
}
|
||
}
|
||
|
||
static void ass6b()
|
||
{
|
||
Console.WriteLine("Enter your grade in [ A B C D E Fx F ]");
|
||
|
||
for (;;)
|
||
{
|
||
var input = Console.ReadLine();
|
||
switch (input)
|
||
{
|
||
case "A":
|
||
Console.WriteLine("Excellent - outstanding performance with only minor errors");
|
||
break;
|
||
case "B":
|
||
Console.WriteLine("Very good – above the average standard but with some errors");
|
||
break;
|
||
case "C":
|
||
Console.WriteLine("Very good – above the average standard but with some errors");
|
||
break;
|
||
case "D":
|
||
Console.WriteLine("Very good – above the average standard but with some errors");
|
||
break;
|
||
case "E":
|
||
Console.WriteLine("Very good – above the average standard but with some errors");
|
||
break;
|
||
case "F":
|
||
Console.WriteLine("Very good – above the average standard but with some errors");
|
||
break;
|
||
case "Fx":
|
||
Console.WriteLine("Very good – above the average standard but with some errors");
|
||
break;
|
||
case "G":
|
||
Console.WriteLine("G pressed Exiting...");
|
||
return;
|
||
//goto default;
|
||
default:
|
||
Console.WriteLine("Invalid input, program quitting because we are sad");
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
Console.WriteLine("Assignment 6");
|
||
//ass6();
|
||
ass6b();
|