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
You are the IT security administrator for a small corporate network. You would like to use Group Policy to enforce settings for
LuckyWell [14K]

Answer/Explanation:

To Complete this lab, do the following:

1. From Server Manager, select Tools > Group Policy Management.

2. Expand Forest: CorpNet.com > Domains > CorpNet.com.

3. Right-click the OU where the policy will be linked and select Create a GPO in this domain, and link it here.

4. In the Name field, enter the GPO name; then click OK.

5. Link the GPO to additional OUs as follows:

a. Right-click the next OU and select Link an Existing GPO to link the GPO to another OU.

b. Under Group Policy objects, select Workstation Settings from the list; then click OK.

c. Repeat step 5 to link additional OUs.

6. Import a security policy template as follows:

a. Expand Group Policy Objects.

b. Right-click Workstation Settings and select Edit.

c. Under Computer Configuration, expand Policies > Windows Settings.

d. Right-click Security Settings and select Import Policy.

e. Browse to the C:\Templates.

f. Select ws_sec.inf; then click Open.

Cheers

3 0
3 years ago
Why are listening and speaking part of the Common Core and ELD Standards? Why is this particularly important for our ELD student
Leona [35]

Answer:

Learning and speaking are core elements in ELD Standards. ELD emphasizes the importance of understanding academic and instructional languages necessary for academic success. For a better understanding of language instructions, there should be some form of communication between the learner and the educator. Communication itself entails listening appropriately and speaking accordingly to convey the right message.

Listening and speaking improves the language skills of students. They are also able to express themselves through speech.

Explanation:

3 0
3 years ago
Write a Python 3 program that will compute the total cost of an amazon purchase. The program should ask the user to enter the am
valentina_108 [34]

Answer:

price = float(input("Enter amount of a purchase: "))

shipping_price = 0.12* price

NJ_sales_Tax = 0.07*price

print('The price of item is {}'.format(price))

print('The Cost of Shipping is {}'.format(shipping_price) )

print('New Jessey Sales Tax is {}'.format(NJ_sales_Tax))

total_bill = shipping_price+NJ_sales_Tax+price

print('Total Bill {} ' .format(total_bill))

Explanation:

  • Prompt User for input of the amount of purchase
  • Calculate the shipping cost (12% of purchase price)
  • Calculate the tax (7% of the purchase price)
  • Use python's .format method to output an itemized bill

3 0
3 years ago
∀פפIN∀W∀ qwda dawdawdawdawd<br> BAN ME NOW
Dvinal [7]

Answer:

why

Explanation:

6 0
3 years ago
Which examples demonstrate common education and qualifications for Manufacturing Production Process Development careers? Check a
Tom [10]

Answer:

The answer is D "Latisha is a Mechanical Engineer with a bachelor's degree"

Explanation:

Workers in Manufacturing Production Process Development are liable for designing plan and plan of the manufacturing process. They work with clients to guarantee the manufacturing process delivers an item that meets or surpasses client expectations. Manufacturing Production Process Development is one of the many career paths in the Manufacturing Industry. Laborers in this Profession Way are liable for fundamental item plans and the plan of the manufacturing process itself. They should reliably draw in with their client to guarantee they produce an item that precisely coordinates their client's necessities. Occupations in this Profession Way incorporate Electrical and Electronic Drafters, Modern Designing Technologists, Assembling Creation Professionals, and Atomic Checking Specialists.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which applicants would be best suited for which jobs based on educational and training? Boris is best suited to be an Electricia
    11·2 answers
  • How do you jumpstart a car in the middle of nowhere??? Explain using 2 paragraphs.
    14·2 answers
  • "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequen
    10·1 answer
  • At what point in a vulnerability assessment would an attack tree be utilized?
    9·1 answer
  • A DBMS makes the: a. relational database available for different analytical views. b. physical database available for different
    12·1 answer
  • Page Up and Page Down keys fall under the ? keys category.
    14·2 answers
  • The smallest unit of storage is​
    15·1 answer
  • The pay of an hourly worker is calculated by multiplying the hours worked by the hourly rate—up to 40 hours; any hours worked be
    11·1 answer
  • Spreadsheet software can be used to do all the following except _____.
    5·2 answers
  • Every Java statement ends with: *<br><br> Period<br> Colon<br> Double quote<br> Semicolon
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!