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
Application means to
lakkis [162]
An application or an app is a type of software that allows us to perform specific task . When you opens an application it runs inside your operating system . If more than one application are opened in one time it is known as multitasking  
Applications of desktop or laptop are called desktop applications while mobile applications are called mobile apps
3 0
3 years ago
Computer programming is an essential skill for anyone wishing to pursue a career in cybersecurity. What might be a good ""first
Jet001 [13]

Answer:

Python is the correct answer.

Explanation:

Python Programming Language is might be good for those programmers who are beginners because the following Language is quite easy and simple to learn. When any programmer using Python Language for the programming then, they easily write their program because of its simplicity, it is easy and quick for learning language. This language creates program easy and short.

3 0
3 years ago
Question 12 (1 point)
QveST [7]

Answer:

margins

Explanation:

the definition margins are the edges

8 0
3 years ago
List any two different between primary memory and secondary memory.​
nikitadnepr [17]

Answer:

Primary memory is directly accessible by Processor/CPU. Secondary memory is not directly accessible by the CPU. ... The memory devices used for primary memory are semiconductor memories. The secondary memory devices are magnetic and optical memories

3 0
3 years ago
Read 2 more answers
The Speed of Sound (Java Project. Please make it easy to understand. I'm a beginner at this. I believe we are supposed to use a
Ilya [14]

Answer:

The program of this question can be given as:

Program:

//import pacakge for user input.

import java.util.Scanner;

//define class  

public class SpeedofSound              

{

  public static void main(String a[]) //define main function

  {  

      //define variable.

      String medium;                            

      double distance,time=0;

      //creating Scanner class object for input from user.

      Scanner s=new Scanner(System.in);  

      //print message.

      System.out.printf("Enter medium(air,water or steel) : ");

      medium=s.nextLine();  //taking input.

      //print message.

      System.out.printf("Enter the distance that the sound will travel : ");

      distance=s.nextDouble(); //taking input.

      switch(medium) //checking condtion between range.

      {

          case "air":

                  time=distance/1100;         //apply formula

                  break;

          case "water":

                  time=distance/4900;            //apply formula

                  break;

          case "steel":

                  time=distance/16400;            //apply formula

                  break;

          default:

                  System.out.printf("Sorry, you must enter air,water or steel"); //error for invalid input of medium

                  System.exit(0);

      }

      System.out.printf("It take "+time+" seconds"); //print final answer.

  }

}

Output:

Enter medium(air,water or steel) : air

Enter the distance that the sound will travel : 200

It take 0.18181818181818182 seconds

Explanation:

In this program first, we import packages for user input. Then we declare the class in the class we declare all the variables and then we create the scanner class object. It is used for taking input from the user. Then we use the switch statement It is used for condition. It works between the ranges. In the switch statement, we apply all the formula that is given in the question. and at the last, we print the output using printf function in java.

6 0
3 years ago
Other questions:
  • Image files are grouped into two categories: _____.
    5·1 answer
  • Before sharing a document, you must first save the document to
    12·1 answer
  • Which is worse: Fast charging (Due to heat) or unplugging before reaching full capacity (On a normal charge)?
    9·1 answer
  • Suppose we are performing a binary search on a sorted array called numbers initialized as follows: // index 0 1 2 3 4 5 6 7 8 9
    9·1 answer
  • A store trying to analyze the behavior of its customers will often maintaina two-dimensional array A, where the rows correspond
    6·1 answer
  • Identifies the row and column that forms the cell
    11·1 answer
  • The Rule of Thirds is a way to:
    14·1 answer
  • Describe how both IPv4 and IPv6 access and utilize TCP as an upper-layer transfer protocol.
    6·1 answer
  • What happens to a message when it is deleted?
    5·2 answers
  • What is e banking effects
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!