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 certain solar energy collector produces a maximum temperature of 100°C. The energy is used in a cyclic heat engine that operat
Gwar [14]

Answer:

\eta _{max} = 0.2413 = 24.13%

\eta' _{max} = 0.5061 = 50.61%

Given:

T_{1max} = 100^{\circ} = 273 + 100 = 373 K

operating temperature of heat engine, T_{2} = 10^{\circ} = 273 + 10 = 283 K

T_{3max} = 300^{\circ} = 273 + 300 = 573 K

Solution:

For a  reversible cycle, maximum efficiency, \eta _{max} is given by:

\eta _{max} = 1 - \frac{T_{2}}{T_{1max}}

\eta _{max} = 1 - \frac{283}{373} = 0.24

\eta _{max} = 0.2413 = 24.13%

Now, on re designing collector, maximum temperature, T_{3max} changes to 300^{\circ}, so, the new maximum efficiency,  \eta' _{max} is given by:

\eta' _{max} = 1 - \frac{T_{2}}{T_{3max}}

\eta _{max} = 1 - \frac{283}{573} = 0.5061

\eta _{max} = 0.5061 = 50.61%

4 0
4 years ago
10 POINTS!!
marusya05 [52]

Answer:

disable yahoo from activating.

Explanation:

 either force quit it or add chrome to your user bar at the bottom of the screen (if ure on a computer) if yahoo is on ur bar make sure to force quit it by right clicking and clicking "force quit" and it should stop

5 0
3 years ago
The rainfall rate in a certain city is 20 inches per year over an infiltration area that covers 33000 acres. Twenty percent of t
Mariana [72]

Answer:

The rate at which water is being withdrawn from the river by the city is 57353 acre-ft/y

Explanation:

Please look at the solution in the attached Word file

Download docx
3 0
4 years ago
Calculate the time taken to completely empty aswimming pool 15
user100 [1]

Answer:

Time needed to empty the pool is 401.35 seconds.

Explanation:

The exit velocity of the water from the orifice is obtained from the Torricelli's law as

V_{exit}=\sqrt{2gh}

where

'h' is the head under which the flow of water occurs

Thus the theoretical discharge through the orifice equals

Q_{th}=A_{orifice}\times \sqrt{2gh}

Now we know that

C_{d}=\frac{Q_{act}}{Q_{th}}

Thus using this relation we obtain

Q_{act}=C_{d}\times A_{orifice}\times \sqrt{2gh}

Now we know by definition of discharge

Q_{act}=\frac{d}{dt}(volume)=\frac{d(lbh)}{dt}=Lb\cdot \frac{dh}{dt}

Using the above relations we obtain

Lb\times \frac{dh}{dt}=AC_{d}\times \sqrt{2gh}\\\\\frac{dh}{\sqrt{h}}=\frac{AC_{d}}{Lb}\times \sqrt{2g}dt\\\\\int_{1.5}^{0}\frac{dh}{\sqrt{h}}=\int_{0}^{t}\frac{0.62\times 0.3}{15\times 9}\times \sqrt{2\times 9.81}\cdot dt\\\\

The limits are put that at time t = 0 height in pool = 1.5 m and at time 't' the height in pool = 0

Solving for 't' we get

\sqrt{6}=6.103\times 10^{-3}\times t\\\\\therefore t=\frac{\sqrt{6}}{6.103\times 10^{3}}=401.35seconds.

4 0
3 years ago
A car is traveling at 50 ft/s when the driver notices a stop sign 100 ft ahead and steps on the brake. Assuming that the deceler
Naddika [18.5K]

Answer:

minimum deceleration = 12.5 ft/s²

Explanation:

Data provided in the question:

Initial speed of the car, u  = 50 ft/s

Distance to cover, s = 100 ft

Final speed of the car = 0 ft/s             [ ∵ as the car stops ]

Now,

from the Newton's equation of motion

we have  

v² - u² = 2as

a is the acceleration

on substituting the respective values, we get

0² - 50² = 2 × a × 100

or

- 2500 = 200a

or

a = - 12.5 ft/s²

Here, the negative sign depicts the deceleration.

4 0
3 years ago
Other questions:
  • Water discharging into a 10-m-wide rectangular horizontal channel from a sluice gate is observed to have undergone a hydraulic j
    14·1 answer
  • Four race cars are traveling on a 2.5-mile tri-oval track. The four cars are traveling at constant speeds of 195 mi/h, 190 mi/h,
    15·1 answer
  • A cable in a motor hoist must lift a 700-lb engine. The steel cable is 0.375in. in diameter. What is the stress in the cable?
    12·1 answer
  • Which of the following are all desirable properties of a hydraulic fluid? a. good heat transfer capability, low viscosity, high
    5·1 answer
  • Initialize the tuple team_names with the strings 'Rockets', 'Raptors', 'Warriors', and 'Celtics' (The top-4 2018 NBA teams at th
    5·1 answer
  • Refrigerant-134a is throttled from the saturated liquid state at 800 kPa to a pressure of 140 kPa. Determine the temperature dro
    13·1 answer
  • The following is a list of metals and alloys:
    10·1 answer
  • What is an unmanned space mission
    9·1 answer
  • You need to lower your lift onto the mechanical load-holding devices to provide structural support before working under the lift
    12·1 answer
  • A voltage _______ is an increase or decrease in the normal line voltage within the range of 5% to -10%.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!