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
Montano1993 [528]
3 years ago
12

Write a function named "isValidPassword" that takes in a string and returns 1 if it stores a valid password and 0 otherwise, A v

alid password must contain at least one lowercase letter, one uppercase letter, and at least one nonletter character. Example: if input string is Example: if input string is "Pass_word", function should return "1" "password", function should return "0"
Computers and Technology
1 answer:
Maslowich3 years ago
8 0

Answer:

Here is code in java.

import java.util.*;

import java.lang.*;

import java.io.*;

class Solution

{

public static void main (String[] args) throws java.lang.Exception

{

   try{

   //declare and initialize string variables

       String str1="password";

       String str2="Pass_word";

    //calling function to check valid password

       System.out.println("output of password is: "+isValidPassword(str1));

        System.out.println("output of Pass_word is: "+isValidPassword(str2));

   }catch(Exception ex){

       return;}

}

// functionn to check the valid password

public  static int isValidPassword(String str)

{

// variables to count the lower,upper and non character

  int i, lower_c = 0, upper_c = 0, non_c = 0;

  char ch;

  for(i=0;i<str.length();i++)

  {

      ch = str.charAt(i);

     if(ch >= 'a' && ch <= 'z')

     {//count of lower character

        lower_c++;

     }

     else if(ch >= 'A' && ch <= 'Z')

     {

   //count of upper character

        upper_c++;

     }

     else

     {

   //count of non character

        non_c++;

     }

  }

  if(lower_c > 0 && upper_c > 0 && non_c > 0) {

     return 1;

  } else {

     return 0;

  }

}

}

Explanation:

Declare and initialize two string variables.In the isValidPassword() function, pass the string parameter and then count the lower, upper and non character in the string.If string contains call the three characters then function will return 1 otherwise it will return 0 .

Output:

output of password is: 0

output of Pass_word is: 1

You might be interested in
Many who move to business-oriented information security were formerly__________ who were often involved in national security or
kirill [66]

Answer:

The information security function

Explanation:

Many who move to business-oriented information security were formerly_____ who were often involved in national security or cybersecurity . All of the above The information security function

5 0
2 years ago
Julian operates his own food truck and is at his busiest during the lunch hour. What might be one task that Julian performs as p
Yuki888 [10]

Preparation of the veggies list is one job linked to Julian's career that she should complete on her own. As a result, option A

<h3>What exactly is a career?</h3>

A career is a collection of events that you have had throughout the course of your life. Your career is being built as you get more experience in the realms of work and life.

Your education, training, and paid or unpaid employment all factor towards your professional path.

As a result, Julian will continue to prepare the list of veggies to be purchased.

Learn more about your Career :

brainly.com/question/13759188

#SPJ1

5 0
2 years ago
6. (5 points) The following instruction sequence is to be executed:
muminat

Answer:

11 cycles.

Explanation:

One interesting thing to observe in this is that, there is no data hazard because here in any of the two consecutive instruction, they do not share any common register and hence no collision.

Also assuming each this program starts with address 0, so that condition checking at the end which is "bne $7, $4, 0x040" will not lead to branching which repeats the loop. Which means this sequence of 7 instructions run only once.

Now if there is no pipeline hazard (which is the case here) and there are n instruction with s stages in pipeline with each stage take 1 cycle, then total cycle required to finish the program will be n+(s-1)=n+s-1

Here number of instruction n=7 and in multicycle datapath usually pipeline stages s=5.

Then number of cycles needed to execute this sequence will be = 7 +5 -1 = 11 cycles

8 0
3 years ago
Which technology will a business use to identify unauthorized access to intranet sites or files by it employees
olga nikolaevna [1]

add the choices..

:)

6 0
4 years ago
Which command in the Linux terminal enables you to find out information about a wireless network adapter comptia
OlgaM077 [116]

Answer:

The command is iwconfig (or ifconfig)

Explanation:

To analyze a wireless network adapter in the Linux Terminal, the command you like to use is iwconfig (or ifconfig).

In windows, Ipconfig carrying out a similar function.  It is important to note that iwconfig does not work in OS X, however, ifconfig does.

The Linux terminal is an app (that has a simple command-line interface). It performs the function of allowing a user to:

  • takes commands from the user, and
  • displays the output on the screen or monitor.

Cheers

6 0
3 years ago
Other questions:
  • Which item below is NOT output? A. monitor B. speakers C. printer D. mouse
    11·2 answers
  • Consider the unsigned decimal number 35. What is the value in hexadecimal?<br><br> 1. 3510 = ____ 16
    13·1 answer
  • The acceleration of a body is 3 metre per second square what does it mean​
    11·2 answers
  • Which of the following correctly orders the investments from LOWER risk to HIGHER risk?
    9·1 answer
  • Murray is a database technician. He has created a single enterprise database system. How is this better than multiple databases
    15·1 answer
  • What type of space is often the main focal point of the composition in graphic design
    13·1 answer
  • ......... mi2hej<br><br>ejid8eo19o1b2bxhxjxjdnneejk2929nr
    5·2 answers
  • What four things does steering control involve?
    11·1 answer
  • Explain why the receptionist responded as indicated in the following scenario.
    8·1 answer
  • An entity is said to be _____-dependent if it can exist in the database only when it is associated with another related entity o
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!