1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alex17521 [72]
3 years ago
5

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 pass

word until the correct password "pals" is entered.
Computers and Technology
1 answer:
Alex787 [66]3 years ago
3 0
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");
You might be interested in
Which of the following is NOT one of the four steps preparing for sales forecast ?
ehidna [41]
Can you post the answers plz
4 0
3 years ago
Which is an example of an effective study skill?
Lelu [443]

Answer:

the making note cards and quizzing yourself

Explanation:

5 0
2 years ago
Read 2 more answers
you'll be organizing the various databases in your organization, and have recommended hiring a/an?A. internet specialist B. comp
jek_recluse [69]
Either c or d, most probably D
7 0
3 years ago
Read 2 more answers
1.A panel that , when active , displays options for the selected tool. *
yKpoI14uk [10]
Is there a question or something
7 0
2 years ago
Read 2 more answers
Implement the function charCnt. charCnt is passed in a name of a file and a single character (type char). This function should o
SVEN [57.7K]

Answer:

Answered below

Explanation:

//Program is written in Python programming language

def charCnt( fileName, char){

if not fileName.exists( ):

return sys.exit(1)

else:

openFile = open("$fileName.txt", "r")

readFile = openFile.read( )

fileLength = len (readFile)

count = 0

for character in range(fileLength):

if readFile[character] == char:

count++

openFile.close( )

return count

}

7 0
2 years ago
Other questions:
  • Caches are important to providing a high-performance memory hierarchy to processors. Below is a list of 32-bits memory address r
    9·1 answer
  • Which of the following is most likely to be a result of hacking? Group of answer choices slowing of network speed certain Web si
    13·1 answer
  • Give your definition of a view. Based on the Academic Database, identify and describe a scenario where it would be necessary to
    10·1 answer
  • By the 1990s, ______________ technology enabled one person operating a desktop computer to control most—or even all—of these fun
    8·2 answers
  • What is the biggest challenge for most business when going online?
    12·1 answer
  • Because people can easily upload information and share online, they tend to:
    15·1 answer
  • Which type(s) of license(s) allow the underlying software code to be viewed?
    15·1 answer
  • What is the document that provides basic guidance and regulatory requirements for derivative classification
    9·1 answer
  • Define the terms network, LAN, WAN, and Internet.
    11·1 answer
  • Heyyyyyy who likes anime​
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!