tiaharris3893 tiaharris3893
  • 07-08-2019
  • Computers and Technology
contestada

write a java program using a do while loop to prompt the user to enter a password. The user should be prompted to enter the password until the correct password "pals" is entered.

Respuesta :

cdw2014
cdw2014 cdw2014
  • 08-08-2019
We can import Scanner from Java.utils.Scanner to pull in text entered in the console.

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String password = "";
do {
System.out.print("Enter your password: ");
password = sc.nextLine();
if(!password.equals("pals") {
System.out.println(\nIncorrect Password. Try again.");
}
} while(!password.equals("pals");
Answer Link

Otras preguntas

Which human development function is described in the following scenario? Mara is playing with her infant, and she repeats the word "ball" over and over while ho
Please answer the following questions. 34. a. Mon prof _____ a téléphoné à son bureau. b. Elle m’a demandé si je _____ ai fait. c. Je lui ai dit que ce n’
An example of cultural convergence
N the 1600s, which scientist discovered microbes in pond water by using a microscope? Theodor schwann robert hooke anton van leeuwenhoek matthias schleiden
Find the mean of the calories burned in the activities listed in the table. 110 450 474 600 802
Which of the following best describes REM sleep?
Social media is becoming more important than face to face communication among teens essay
What is 412 divine by 8 but in Interpret the remainder Way please help
50 PTS NEED TRANSLATION!! PLEASE DONT POST WRONG ANSWERS!! I don't speak English. No habla inglés. No hablas inglés. No hablan inglés. No hablo inglés.
Does any one know the munsees deities