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]
4 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:
Maslowich4 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
In your own words, what is pair-programming? What is the role of the driver? What is the role of the navigator? What are some be
KATRIN_1 [288]

<u>Paired programming:</u>

Paired programming is a new technique where one person gets one another to<em> write the code</em>. Here one will write the code and other will start verifying as the type.

So we might think it is waste to employ two person for same task but it is not so. There are many <em>benefits in incorporating this technique</em>. Let us see those benefits one by one.

  • <em>Inter-personal skill gets improved </em>
  • <em>Lower amount of coding mistake </em>
  • <em>Learn from each other </em>
  • <em>Peer review enhance collaboration </em>

Challenges expect to arise during pair-programming

  • Two heads are superior to one. On the off chance that the driver experiences a <em>hitch with the code</em>, there will be two of them who'll take care of the issue.  
  • Builds up your <em>staff's relational aptitudes</em>. Working together on a solitary venture encourages your group to welcome the estimation of <em>correspondence and collaboration.  </em>

Overcome Method

The most ideal approach to move <em>toward blending</em> is to accomplice two software engineers and have them share a PC. The pair ought to have the option to choose how to part the work, and it is prudent that they should <em>switch jobs frequently.</em>

7 0
4 years ago
Which type of app is the best choice when it is critical to be able to use the device's features but performance is not critical
Alchen [17]

Answer:

The answer is not native. I just got in wrong.

Explanation:

Edge 2021

4 0
3 years ago
Read 2 more answers
E-mail is the most common distributed application that is widely used across all architectures and vendor platforms.a) trueb) fa
Advocard [28]

Answer:

A. True.

Explanation:

E-mail is an acronym for electronic mail and it can be defined as an exchange or transmission of computer-based data (messages) from one user to another over a communications network system.

Also, a distributed application refers to a software program that is capable of running on several computer systems and can communicate effectively through a network.

E-mail is the most common distributed application that is widely used across all architectures and vendor platforms because it primarily operates on a client-server model, by providing users with the requested services through the Simple Mail Transfer Protocol (SMTP) using the standard port number of 25.

7 0
3 years ago
Your company is implementing a wireless network and is concerned that someone from a competing company could stand outside the b
hoa [83]

Answer:

Option A i.e., AES is correct.

Explanation:

The user corporation is installing the wireless server and seems to be worried when anyone representing the rival corporation might stands outside that property as well as gather wireless information. He ensured that corporation which WPA2 is safe. However, AES creates WPA2 stronger than WPA.

  • Option B is incorrect according to the following scenario because it is the security mechanism used when component through the IEEE 802.11i WLAN standard.
  • Option C is incorrect according to the following scenario because it is the protocol initially developed for configure wireless clients to such a dial-in connection device.
  • Option D is also incorrect according to the following scenario because it is the terminal access control.
6 0
3 years ago
What is the system of computers, routers, wires, cables,etc. that allow computers to communicate called?
Anika [276]
Internet maybe?
Not 100% sure though
5 0
3 years ago
Other questions:
  • Which option allows you to view slides on the full computer screen?
    11·1 answer
  • What is the unit of measure that specifies the value of cellspacing?
    9·1 answer
  • Cheryl has several concepts for mobile apps for smartphones. A friend suggests that she develop her apps for an open-source oper
    13·1 answer
  • Choose all of the items that represent operating systems largely derived from UNIX. GNU/Linux, Mac OS X, IBM, OS/360, BSD, Windo
    12·2 answers
  • Which device uses radio waves? ceiling fan microwave oven air conditioner x-ray machine?
    7·1 answer
  • As a computer science student, which career you will select and what do you predict about the future of that specific IT-Career.
    8·1 answer
  • Why is the GPS so important today?
    9·1 answer
  • With that ------ outlook he doesn't trust anyone.
    11·1 answer
  • Time
    6·1 answer
  • How do I make time go by faster?? school is so boring gosh..
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!