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
Within a cubic unit cell, sketch the directions of [012], [721], [110].
exis [7]

Answer:

[012]  :

Here x component is zero. That is why this is  in y- z plane

[721] :      

This is  in  all three plane .It means it is in space.

[110]  :

Here z component is zero.

That is why this is  in x -y plane

From the cubic unit directions we can easily understand all given directions  [012], [721], [110].

7 0
3 years ago
Respond with TRUE if the symbol of the valve shown below is
nevsk [136]

Answer:

true

Explanation:

bc the right plus left valve

5 0
3 years ago
Is a diesel truck less expensive to drive than a gas truck?
MArishka [77]

Answer:

Typically, diesel trucks cost more than those with gas engines, especially when you're first buying them, as diesel is usually featured as an add-on for gas-powered cars. Diesel add-ons can cost over $5,000 for midsize trucks and around $10,000 for heavy-duty trucks.

Explanation:

Make me brain pls

3 0
2 years ago
Sarah is developing a Risk Assessment for her organization. She is asking each department head how long can they be without thei
Natali [406]

Answer:

Sarah is asking each department head how long they can be without their primary system. Sarah is trying to determine the Recovery Time Objective (RTO) as this is the duration of time within which the primary system must be restored after the disruption.

Recovery Point Objective is basically to determine the age of restoration or recovery point.

Business recovery and technical recovery requirements are to assess the requirements to recover by Business or technically.

Hence, Recovery Time Objective (RTO) is the correct answer.

8 0
3 years ago
Most pedestrian fatalities occur
Makovka662 [10]

Answer: Outside an intersections

Explanation:

6 0
4 years ago
Other questions:
  • You are traveling upstream on a river at dusk. You see a buoy with the number 5 and a flashing green light . What should you do?
    8·1 answer
  • When the rope is at an angle of α = 30°, the 1-kg sphere A has a speed v0 = 0.6 m/s. The coefficient of restitution between A an
    8·1 answer
  • A customer got debited twice, how would you investigate and resolve this conflict on the customer side and on the company side?
    5·1 answer
  • Help please!
    13·1 answer
  • One year, Boulder receives an unusually high amount of rain during the spring months. How might this event affect the likelihood
    15·1 answer
  • 4. Which type of duct undergoes more rigorous testing before it's labeled?
    12·1 answer
  • Who wants me to make a device to resurrect Juice Wrld
    7·1 answer
  • Which of these items is least likely to cause an exhaust emission test failure as of a result of excessive nox emissions? a) poo
    15·1 answer
  • ANSWER PLEASE
    8·2 answers
  • How many watts are consumed in a circuit having a power factor of 0. 2 if the input is 100 vac at 4 amperes?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!