Question: C# CODE/ VISUAL STUDIOS Write a console application that prompts users to input a password, Password#1 users should have three 3 opportunities to input the
C# CODE/ VISUAL STUDIOS Write a console application that prompts users to input a password, Password#1 users should have three 3 opportunities to input the correct password. If a user inputs three 3 incorrect passwords, a message should display indicating that access is denied due to too many unsuccessful login attempts the program should gracefully close following this message. Should a user supply the correct password, the application should simply print an access granted message prior to gracefully closing. Your application should include a method that checks a user-provided password for validity and also tracks the numbers of unsuccessful login attempts.
{ static void Main(string[] args) { { string password = "Password#1"; string input; bool passSuccess, loginFail; int attempts = 0, flag = 0; while (true) { Console.WriteLine("Please input password"); input = Console.ReadLine(); passSuccess = passCheck(input, password); if (passSuccess) { flag = 1; break; } attempts++; loginFail = loginCount(attempts); if (loginFail) break; } if (flag == 1) Console.WriteLine("Access granted"); else Console.WriteLine("Access deined"); } bool passCheck(String inputPass, String sysPass) { if (inputPass.Equals(sysPass)) { return true; } else return false; } bool loginCount(int numOfLogins) { if (numOfLogins == 3) { return true; } else return false; } } } }
I FINISHED PART 1 BUT DONT KNOW HOW TO DO PART 2... HELP:{
PART 2 Instead of prompting users to input a correct password; prompt users to create a strong password. Write methods that check the user-provided password for the following complexity requirements: Password length ten (10) characters Must contain at least one (1) number Must contain at least one (1) uppercase character Must contain at least one (1) special character ~!@#$%^&*()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
