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
What are two advantages of a pay-for-use online conferencing service compared to a free service? (Choose two)
tester [92]

Answer:

Provision of both audio and video

,dedicated support

Explanation:

Free services are not dedicated digital lines so there is no guarantee of high-quality sound or a reliable connection during the call. Some common issues  are background noises, crackling, echoes, distortion, quietness and drop-outs.Free services also don't offer dedicated support so if anything goes wrong there's nobody available to help you. Any of these problems can ruin the productivity and flow of your meeting.

5 0
3 years ago
You can display content variations to mobile, tablet or desktop users.
umka21 [38]

Answer:

The following statement is true.

Explanation:

Because the user easily monitors the content variations by using some applications or software for the mobile or desktops without facing any difficulties in displaying the several content. If they facing some issues then, there is the problem of their mobile or computer or maybe any issues occurs in their application according to the configuration of their system.

7 0
3 years ago
Which statement is true?
Alexeev081 [22]

Answer:

Bjarne Stroustrop published the first reference guide for C++

Explanation:

Bjarne Stroustrop is a computer scientist who created the C++ programming language while working at the AT&T Bell laboratory. He also published the first reference guide for the programming language.

In October 1985, the book, The C++ Programming Language, was published. It describes the c++ programming language and was the only documentation and reference guide for the programming language at the time. Newer editions have since been published.

7 0
3 years ago
Read 2 more answers
What is a spreadsheet program?<br> A spreadsheet program is a computerized version of_________.
BabaBlast [244]
I dont know what exact answer youre looking for because you didnt provide options but..
"A spreadsheet<span> is </span>a sheet<span> of paper that shows accounting or other data in rows and columns; </span>a spreadsheet<span> is also a </span>computer<span> application </span>program<span> that simulates a physical </span>spreadsheet<span> by capturing, displaying, and manipulating data arranged in rows and columns."</span>
3 0
3 years ago
Read 2 more answers
Defination of formula bar​
laila [671]

Answer:

formula bar shows the contents of the current cell and allows you to create and view the formulas

6 0
3 years ago
Other questions:
  • WILL GIVE BRAINLIEST! I'm doing a project at school. Does anyone have any good explanations for Digital Art? I need it to be at
    13·2 answers
  • What is binary in computer science ​
    11·1 answer
  • Can you please answer these questions for me: Is it illegal to copyright? What does it mean to get copyrighted? What are example
    12·2 answers
  • In fixed-width files, each record is on a separate line and the fields are separated by a special character.
    7·1 answer
  • Heres the last questions
    5·1 answer
  • "which type of network connects smart devices or consumer electronics within a range of about 30 feet (10 meters) and without th
    7·1 answer
  • The most common types of effects include entrances and exits
    11·1 answer
  • How to transfer polygon from eth to polygon in ledger live
    6·1 answer
  • Active directory and 389 directory server are both compatible with which directory access protocol?
    6·1 answer
  • One of the most notable impacts of IT on business is improved
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!