private static Random random = new Random();
public static void Main(String[] args)
String[] userName = new String[5];
int[] password = new int[5];
for (index = 0 ; index <= 4 ; index += userName.Length)
userName[0] = (char) (random.Next(26) + 65) + (char) (random.Next(26) + 65) + (char) (random.Next(26) + 65);
userName[1] = (char) (random.Next(26) + 65) + (char) (random.Next(26) + 65) + (char) (random.Next(26) + 65);
userName[2] = (char) (random.Next(26) + 65) + (char) (random.Next(26) + 65) + (char) (random.Next(26) + 65);
userName[3] = (char) (random.Next(26) + 65) + (char) (random.Next(26) + 65) + (char) (random.Next(26) + 65);
userName[4] = (char) (random.Next(26) + 65) + (char) (random.Next(26) + 65) + (char) (random.Next(26) + 65);
for (index = 0 ; index <= 4 ; index += password.Length)
for (index = 0 ; index <= userName.Length - 1 ; index += 1)
Console.WriteLine(index.ToString() + "," + userName[index] + "," + password[index]);
Console.WriteLine("Please enter a username");
if (userName[index] == userInput1)
Console.WriteLine("Please enter a password");
index = password.Length - 1;
if (password[index] == userInput)
for (userInput = 0 ; userInput <= 2 ; userInput += 1)
Console.WriteLine("Sorry please enter a valid password");
if (password[index] == userInput)
if (password[index] == userInput)
for (userInput = 0 ; userInput <= 2 ; userInput += 1)
Console.WriteLine("Sorry please enter a valid password");
if (password[index] == userInput)
while (userName[index] != userInput1)
Console.WriteLine("Sorry please enter a valid username");
if (userName[index] == userInput1)
if (password[index] == userInput)
for (userInput = 0 ; userInput <= 4 ; userInput += 1)
Console.WriteLine("Sorry please enter a valid password");
if (password[index] == userInput)
Console.WriteLine("Welcome to the system");
Console.WriteLine("Sorry, Acces denied");
private static void input(out double result)
while (!double.TryParse(Console.ReadLine(), out result));
private static void input(out int result)
while (!int.TryParse(Console.ReadLine(), out result));
private static void input(out Boolean result)
while (!Boolean.TryParse(Console.ReadLine(), out result));
private static void input(out string result)
result = Console.ReadLine();