004-005-006
While Loop: Password Retry
Easy
Problem Description
while loop: Password Retry
In this problem, you will create a program that repeatedly prompts for a password using a while loop until the correct value ("secret") is entered, and displays the authentication result to standard output.
Learning Objective: Implement processing that repeats until condition changes using while loop
Repeat password input until correct value entered. Implement authentication loop using while loop.
Input
Line 1 onwards: Password attempts (string, multiple lines possible)
Output
When incorrect:
Incorrect. Please try again.
```java
When correct:
```java
Authentication successful!
```java
Correct password: "secret".
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up