Question: Write a java program that reads a string (password) and a number. The program will keep asking the user for a password and number as
Write a java program that reads a string (password) and a number. The program will keep asking the user for a password and number as long as the user does not provide the expected values ("ducks" and 1932, respectively), and as long as the user has not exhausted the maximum number of attempts (3 for this project). In addition, the program will stop asking for data if the word "quit" is provided as a password value (in this case, the program will not read the number). The program will print the message "Wrong credentials" when an invalid password or number (or both) is provided. If the user eventually provides the correct credentials the message "Access Granted" will be displayed; otherwise the message "Access Denied" will be generated. The following example illustrates the messages to use to read data and to display results.
Enter password: ducks
Enter number: 10
Wrong credentials
Enter password: quizara
Enter number: 1932
Wrong credentials
Enter password: ducks
Enter number: 1932
Access Granted
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
