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
fenix001 [56]
3 years ago
10

Assume we have already defined a variable of type String called password with the following line of code: password' can have any

String value String password ???"; However, because of increased security mandated by UCSD's technical support team, we need to verify that passwo rd is secure enough. Specifically, assume that a given password must have all of the following properties to be considered "secure": It must be at least 7 characters long .It must have characters from at least 3 of the following 4 categories: Uppercase (A-Z), Lowercase (a-z), Digits (0-9), and Symbols TASK: If password is secure, print "secure", otherwise, print "insecure" HINT: You can assume that any char that is not a letter (A-Z, a-z) and is not a digit (0-9) is a symbol. EXAMPLE: "UCSDcse11" would be valid because it is at least 7 characters long (it's 9 characters long), it has at least one uppercase letter (U', 'C', 'S', and 'D'), it has at least one lowercase letter (c', 's', and 'e'), and it has at least one digit (1' and '1') EXAMPLE: "UCSanDiego" would be invalid because, while it is 10 characters long, it only has uppercase and lowercase letters, so it only has characters from 2 of the 4 categories listed Sample Input: UCSDcse11 Sample Output: secure
Engineering
1 answer:
omeli [17]3 years ago
5 0

Answer:

The Java code is given below with appropriate comments for better understanding

Explanation:

import java.util.Scanner;

public class ValidatePassword {

  public static void main(String[] args) {

      Scanner input = new Scanner(System.in);

          System.out.print("Enter a password: ");

          String password = input.nextLine();

          int count = chkPswd(password);

          if (count >= 3)

              System.out.println("Secure");

          else

              System.out.println("Not Secure");

  }

  public static int chkPswd(String pwd) {

      int count = 0;

      if (checkForSpecial(pwd))

          count++;

      if (checkForUpperCasae(pwd))

          count++;

      if (checkForLowerCasae(pwd))

          count++;

      if (checkForDigit(pwd))

          count++;

      return count;

  }

  // checks if password has 8 characters

  public static boolean checkCharCount(String pwd) {

      return pwd.length() >= 7;

  }

  // checks if password has checkForUpperCasae

  public static boolean checkForUpperCasae(String pwd) {

      for (int i = 0; i < pwd.length(); i++)

          if (Character.isLetter(pwd.charAt(i)) && Character.isUpperCase(pwd.charAt(i)))

              return true;

      return false;

  }

  public static boolean checkForLowerCasae(String pwd) {

      for (int i = 0; i < pwd.length(); i++)

          if (Character.isLetter(pwd.charAt(i)) && Character.isLowerCase(pwd.charAt(i)))

              return true;

      return false;

  }

  // checks if password contains digit

  public static boolean checkForDigit(String pwd) {

      for (int i = 0; i < pwd.length(); i++)

          if (Character.isDigit(pwd.charAt(i)))

              return true;

      return false;

  }

  // checks if password has special char

  public static boolean checkForSpecial(String pwd) {

      String spl = "[email protected]#$%^&*(";

      for (int i = 0; i < pwd.length(); i++)

          if (spl.contains(pwd.charAt(i) + ""))

              return true;

      return false;

  }

}

You might be interested in
A kitchen contains one section of counter that's 20 inches
Ne4ueva [31]

The number of receptacles that are needed for all of these kitchen areas are: C. Four.

<h3>What are receptacles?</h3>

Receptacles can be defined as types of sockets or series of outlets (openings) that provides a path where current can be taken in a wiring system, so as to run electrical appliances in buildings.

Based on the information provided, the number of receptacles that are needed for all of these kitchen areas are four because one would be used in each area.

Read more on receptacles here: brainly.com/question/23839796

#SPJ1

4 0
2 years ago
3. A 4-m × 5-m × 7-m room is heated by the radiator of a steam-heating system. The steam radiator transfers heat at a rate of 10
Natali [406]

Answer:

14.52 minutes

<u>OR</u>

14 minutes and 31 seconds

Explanation:

Let's first start by mentioning the specific heat of air at constant volume. We consider constant volume and NOT constant pressure because the volume of the room remains constant while pressure may vary.

Specific heat at constant volume at 27°C = 0.718 kJ/kg*K

Initial temperature of room (in kelvin) = 283.15 K

Final temperature (required) of room = 293.15 K

Mass of air in room= volume * density= (4 * 5 * 7) * (1.204 kg/m3) = 168.56kg

Heat required at constant volume: 0.718 * (change in temp) * (mass of air)

Heat required = 0.718 * (293.15 - 283.15) * (168.56) = 1,210.26 kJ

Time taken for temperature rise: heat required / (rate of heat change)

Where rate of heat change = 10000 - 5000 = 5000 kJ/hr

Time taken = 1210.26 / 5000 = 0.24205 hours

Converted to minutes = 0.24205 * 60 = 14.52 minutes

4 0
4 years ago
A 1-ft rod with a diameter of 0.5 in. is subjected to a tensile force of 1,300 lb and has an elongation of 0.009 in. The modulus
iragen [17]

Answer:

E = 8.83 kips

Explanation:

First, we determine the stress on the rod:

\sigma = \frac{F}{A}\\\\

where,

σ = stress = ?

F = Force Applied = 1300 lb

A = Cross-sectional Area of rod = 0.5\pi \frac{d^2}{4} = \pi \frac{(0.5\ in)^2}{4} = 0.1963\ in^2

Therefore,

\sigma = \frac{1300\ lb}{0.1963\ in^2} \\\\\sigma = 6.62\ kips

Now, we determine the strain:

strain = \epsilon = \frac{elongation}{original\ length} \\\\\epsilon = \frac{0.009\ in}{12\ in}\\\\\epsilon =  7.5\ x\ 10^{-4}

Now, the modulus of elasticity (E) is given as:

E = \frac{\sigma}{\epsilon}\\\\E = \frac{6.62\ kips}{7.5\ x\ 10^{-4}}

<u>E = 8.83 kips</u>

7 0
3 years ago
Pls help!!! will give brainly!!!
gogolik [260]
Short-term goals are planned for the near future while long-term goals will take longer to complete. An example of a short-term goal is trying to get into a certain college. A long-term goal is wanting to have a big family.
3 0
3 years ago
The net potential energy EN between two adjacent ions, is sometimes represented by the expression
Anastaziya [24]

Answer:

as answered in the attached file.

Explanation:

The detailed steps, derivation and appropriate differentiation is as shown in the attachment

3 0
3 years ago
Other questions:
  • The 150-lb man sits in the center of the boat, which has a uniform width and a weight per linear foot of 3 lb&gt;ft. Determine t
    9·1 answer
  • The uniform dresser has a weight of 90 lb and rests on a tile floor for which the coefficient of static friction is 0.25. If the
    6·1 answer
  • Which of the following manufacturing tools machines parts by moving the part into the cutting tool (instead of moving the cuttin
    13·1 answer
  • Asolid rectangular rodhas a length of 90mm, made of steel material (E =207,000 MPa, Syield= 300 MPa), the cross section of the r
    14·1 answer
  • (a) If 5 x 10^17 phosphorus atoms per cm3 are add to silicon as a substitutional impurity, determine the percentage of silicon a
    5·1 answer
  • Home safety and security is an _________<br><br> process. (7 Letters)<br><br> Answer
    10·1 answer
  • 5. After a long period of pumping from an unconfined aquifer at a constant rate of 850 m3/day, the cone of depression reaches eq
    11·1 answer
  • Mr. Ray deposited $200,000 in the Old and Third National Bank. If the bank pays 8% interest, how much will he have in the accoun
    10·2 answers
  • If a soil has e=0.72, moisture content = 12% and Gs=2.72, find the weight of water in KN/m3 to be added to make the soil saturat
    6·1 answer
  • The food and drug administration exists to protect the public against …
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!