Question: ANSWER NEEDED IN C# 1. Create a new function called AskForPassword, it should have 1 string parameter, and it returns a bool. 2. This function

ANSWER NEEDED IN C#

1. Create a new function called AskForPassword, it should have 1 string parameter, and it returns a bool. 2. This function should ask the user to enter a top secret password, given to you, the programmer, by the parameter. 3. The program should loop until the user enters the correct password, or the loop has repeated 5 times, whichever occurs first. 4. If the user enters the same password as the one provided by the parameter, then return true. 5. If the user does NOT enter the same password as the one provided by the parameter, then return false. 6. Call this function from your main method to test it. a. Use an if statement to determine if the user entered the correct password or not. b. What happens if the user guesses correctly on the first try? Third? Fifth? c. What happens if the user can NOT guess correctly by the fifth try?

d. Leave a comment stating if your test was successful, and if you got the behavior from your program that you expected.

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!