-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
27 lines (20 loc) · 899 Bytes
/
Program.cs
File metadata and controls
27 lines (20 loc) · 899 Bytes
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
string roleName = "";
string? readResult;
bool validInput = false;
Console.WriteLine("Enter your role name (Administrator, Manager, or User)");
do
{
readResult = Console.ReadLine();
roleName = readResult.Trim();
if (roleName.ToLower() == "administrator" || roleName.ToLower() == "manager" || roleName.ToLower() == "user")
{
validInput = true;
}
else{
Console.WriteLine($"The role name that you entered, \"{roleName}\" is not valid. Enter your role name (Administrator, Manager, or User)");
}
} while(validInput == false);
/* Here we are making the first letter in the word uppercase and the rest lowercase */
string capitalized = char.ToUpper(roleName[0]) + roleName.Substring(1).ToLower();
/* Printing the success message on the console */
Console.WriteLine($"Your input value ({capitalized}) has been accepted.");