Question: Write a simple password program with C#. Have the user repeatedly enter a password until the secret word Password is entered. Further, add an if

Write a simple password program with C#. Have the user repeatedly enter a password until the secret word Password is entered. Further, add an if statement that outputs a message for all incorrect tries. Finally, only allow 5 tries, and remember to display a password warning message.

The output should look like this:

Please enter the password: Apple You have 4 tries left, try again: Hello You have 3 tries left, try again: Testing You have 2 tries left, try again: Pass You have 1 tries left, try again: CompSci Access is denied, Good Bye. 

Or

Please enter the password: password You have 4 tries left, try again: PASSWORD You have 3 tries left, try again: Password Access is GRANTED, Welcome home!

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!