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
andrew11 [14]
4 years ago
15

Write an application that prompts the user for a password that contains at least two uppercase letters, at least three lowercase

letters, and at least one digit. Continuously reprompt the user until a valid password is entered. Display a message indicating whether the password is valid; if not, display the reason the password is not valid. Save the file as ValidatePassword.java
Engineering
1 answer:
const2013 [10]4 years ago
8 0

Answer:

import java.util.Scanner;

public class ValidatePassword {

  public static void main(String[] args) {

      // TODO Auto-generated method stub

      Scanner scanner = new Scanner(System.in);

      do {

          System.out.print("\nEnter Password:");

          String password = "";

          password = scanner.nextLine();

          int upperFound = 0, lowerFound = 0, digitFound = 0;

          for (char c : password.toCharArray()) {

              if (Character.isUpperCase(c)) {

                  upperFound++;

              } else if (Character.isLowerCase(c)) {

                  lowerFound++;

              } else if (Character.isDigit(c)) {

                  digitFound++;

              }

          }

          String errorMessage = "";

          if (upperFound < 2) {

              errorMessage += "\n uppercase letters";

          }

          if (lowerFound < 2) {

              errorMessage += "\n lowercase letters";

          }

          if (digitFound < 2) {

              errorMessage += "\n digits";

          }

          // System.out.println(errorMessage);

          if (errorMessage.length() > 1) {

              System.out

                      .println("The password did not have enough of the following: "

                              + errorMessage);

          } else {

              System.out.println("Valid password");

              break;

          }

      } while (true);

  }

}

output:

Enter Password:23testkk

The password did not have enough of the following:

uppercase letters

Enter Password:TESTabc12345

Valid password

You might be interested in
Determine if the fluid is satisfied​
guapka [62]
Is there a picture or something?
8 0
3 years ago
A refrigerator has a cooling load of 50 kW. It has a COP of 2. It is run by a heat engine which consumes 50 kW of heat to supply
Sunny_sXe [5.5K]

Answer:

50%

Explanation:

<u>Given information</u>

Cooling load=50 kW

COP=2

Consumption=50 kW

<u>Calculations</u>

Revised input is given by cooling load/COP=50/2=25 kW

Efficiency= Work output/ Revised input=25/50=0.5

Efficiency=0.5*100=50%

8 0
3 years ago
The driveshaft of an automobile is being designed to transmit 238 hp at 3710 rpm. Determine the minimum diameter d required for
AURORKA [14]

Explanation:

Below is an attachment containing the solution.

4 0
4 years ago
Who can work on a fixed ladder that extends more than 24 feet?
baherus [9]

Answer:

Explanation:

If the fixed ladder will reach more than twenty-four (24) feet above a lower level, you as the employer are required to incorporate a personal fall arrest or ladder safety system into the installation of the ladder. For reference, this requirement is cited in OSHA Section 1910.28(b)(9)(i).

If the total length of the climb on a fixed ladder equals or exceeds 24 feet (7.3 m), the ladder must be equipped with ladder safety devices; or self-retracting lifelines and rest platforms at intervals not to exceed 150 feet (45.7 m); or a cage or well and multiple ladder sections with each ladder section not

plz mark as brainliest

8 0
3 years ago
How much work, in Newtons, is required to lift a 20.4-kg (45lb) plate from the ground to a stand that is 1.50 meters up?
nataly862011 [7]

Answer:

Explanation:

Work, U, is equal to the force times the distance:

U = F · r

Force needed to lift the weight, is equal to the weight: F = W = m · g

so:

U = m · g · r

   = 20.4kg · 9.81 \frac{N}{kg} · 1.50m

   = 35.316 \frac{N}{m}

   = 35.316 W

4 0
3 years ago
Other questions:
  • The slope of a moment diagram is the load. a)-True b)-False
    8·1 answer
  • When in a flow do the streamlines, streak lines and timelines coincide?
    14·1 answer
  • Write multiple if statements
    5·1 answer
  • . Which of the following formula is used for calculating current:
    15·1 answer
  • A restaurant and dairy are participating in a community digester pilot program within the UMD Industrial Park. The following was
    9·1 answer
  • If most wildfires are suppressed (all fires are put out) for many years, how does the risk of wildfire in the area change in the
    10·1 answer
  • Select the correct answer
    15·1 answer
  • Reverse Engineering: Structural Analysis
    14·1 answer
  • How are sedimentary - gravity flows different from fluid - gravity flows
    6·1 answer
  • The team needs to choose a primary view for the part drawing. Three team members make suggestions:
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!