ms_learn_csharp/013_eval_boolean_expressions/logic_challenge/Program.cs
2024-07-19 20:30:50 -04:00

23 lines
739 B
C#

string[] users = new String[] { "Admin", "Admin", "Manager", "Manager", "User" };
int[] levels = new int[] { 56, 55, 21, 19, 100 };
int counter = 0;
foreach (string user in users) {
int level = levels[counter++];
switch (user) {
case "Admin":
Console.WriteLine($"Wellcome, {(level > 55 ? "Super " : "")}Admin user.");
break;
case "Manager":
if (level >= 20) {
Console.WriteLine("Contact an Admin for access.");
} else {
Console.WriteLine("You do not have sufficient privileges.");
}
break;
default:
Console.WriteLine("You do not have sufficient privileges.");
break;
}
}