Question: C# CODING/ 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# CODING/ 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.

//THIS WHAT I GOT SO FAR BUT CANT FIGURE OUT REST

public static void Main(string[] args) { string password = "Password#1"; string input; bool passSuccess, loginFail; int attempts = 0; do { Console.WriteLine("Please input password"); input = Console.ReadLine(); passSuccess =passCheck(input,password); attempts++; loginFail = loginCount(attempts); } while (!passSuccess && !loginFail); Console.WriteLine(); Console.WriteLine("Please [ENTER] to quit"); Console.ReadKey(); } } } private static bool passCheck(String inputPass, String sysPass) { if (inputPass.Equals(sysPass)) { return true; } else return false; } private static bool loginCount(int numOfLogins) { if (numOfLogins == 3) { return true; } else return false; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!