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
An ideal gas mixture has a volume base composition of 40% Ar and 60% Ne (monatomic gases). The mixture is now heated at constant
baherus [9]

[Find the attachment]

6 0
3 years ago
Fibonacci sequence has many applications in Computer Science. Write a program to generate Fibonacci numbers as many as desired.
VikaD [51]

Answer:

The Python Code for Fibonacci Sequence is :

# Function for nth Fibonacci number  

def Fibonacci(n):  

if n<0:  

 print("Incorrect input")  

# First Fibonacci number is 0  

elif n==0:  

 return 0

# Second Fibonacci number is 1  

elif n==1:  

 return 1

else:  

 return Fibonacci(n-1)+Fibonacci(n-2)  

# Driver Program  

print(Fibonacci(9))  

Explanation:

The Fibonacci numbers are the numbers in the following integer sequence.

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ……..

In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation

Fn = Fn-1 + Fn-2

with seed values

F0 = 0 and F1 = 1.

8 0
3 years ago
Read 2 more answers
3. In order to obtain your commercial driver's license (CDL) you must first:
Murljashka [212]
A and C is the answer to the question. Be 15 years old & get a permit
8 0
3 years ago
a cantilever beam 1.5m long has a square box cross section with the outer width and height being 100mm and a wall thickness of 8
djverab [1.8K]

Answer:

a) 159.07 MPa

b) 10.45 MPa

c) 79.535 MPa

Explanation:

Given data :

length of cantilever beam = 1.5m

outer width and height = 100 mm

wall thickness = 8mm

uniform load carried by beam  along entire length= 6.5 kN/m

concentrated force at free end = 4kN

first we  determine these values :

Mmax = ( 6.5 *(1.5) * (1.5/2) + 4 * 1.5 ) = 13312.5 N.m

Vmax = ( 6.5 * (1.5) + 4 ) = 13750 N

A) determine max bending stress

б = \frac{MC}{I}  =  \frac{13312.5 ( 0.112)}{1/12(0.1^4-0.084^4)}  =  159.07 MPa

B) Determine max transverse shear stress

attached below

   ζ = 10.45 MPa

C) Determine max shear stress in the beam

This occurs at the top of the beam or at the centroidal axis

hence max stress in the beam =  159.07 / 2 = 79.535 MPa  

attached below is the remaining solution

6 0
3 years ago
Chad is working on a design that uses the pressure of steam to control a valve in order to increase water pressure in showers. W
Natalija [7]

Answer:

C: Viscosity, the resistance to flow that fluids exhibit

Explanation:

Did it on Edge :)

8 0
3 years ago
Other questions:
  • The boiler pressure is 38bar and the condenser pressure 0.032 bar.The saturated steam is superheated to 420 oC before entering t
    8·1 answer
  • Where Does a Solar Engineer Work? <br> (2 sentences or more please)
    14·2 answers
  • Estudio de caso Teorema de Bayes. Las historias de casos clínicos indican que diversas enfermedades producen sistemas similares.
    14·1 answer
  • What does it mean when it says technology is A dynamic process
    7·1 answer
  • Consider a very long, cylindrical fin. The temperature of the fin at the tip and base are 25 °C and 50 °C, respectively. The dia
    14·1 answer
  • i need jacket for my daughter who will be going on a girls scouts camping trip it cannot be bulky because she is limited to one
    8·2 answers
  • As described in "A Note About Bacterial Reproduction -- and the "Culture Bias,"" the organism Epulopisciumdoes not divide by bin
    12·1 answer
  • The housing for a certain machinery product is made of two components, both aluminum castings. The larger component has the shap
    10·1 answer
  • Technician a says that if a tapered roller bearing is adjusted to loose
    15·1 answer
  • For the floor plan shown, if a = sm b= 8m, specify type of Load on Beam AHS<br> D<br> B В
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!