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
Doe's anyone know how to access developer mode on a Chromebook laptop if enterprise enrollment blocks it?
Mekhanik [1.2K]
♥ <span>Boot your Chromebook into recovery Mode
(Escape refresh and power keys all need to be help down)
It </span><span>will then  reboot into recovery mode
♥ </span><span>Press Ctrl+D at the recovery screen
♥ </span><span>To turn the Verification off you will need to press the enter button.
♥ and then you have it :D 

</span>
8 0
3 years ago
Read 2 more answers
Explain how Steve Jobs created and introduced the iPhone and iPad.
Natali5045456 [20]

Answer:Today, we're introducing three revolutionary products. The first one is a widescreen iPod with touch controls. The second is a revolutionary mobile phone. And the third is a breakthrough Internet communications device. So, three things: a widescreen iPod with touch controls, a revolutionary mobile phone, and a breakthrough Internet communications device. An iPod, a phone, and an Internet communicator. An iPod, a phone...are you getting it? These are not three separate devices. This is one device. And we are calling it iPhone. Today, Apple is going to reinvent the phone.

Late last year, former Apple engineer Andy Grignon, who was in charge of the radios on the original iPhone, gave behind-the-scenes look at how Apple patched together demos for the introduction, with Steve Jobs showing off developmental devices full of buggy software and hardware issues. The iPhone team knew that everything had to go just right for the live iPhone demos to succeed, and they did, turning the smartphone industry on its head even as Apple continue to scramble to finish work on the iPhone.

Apple had actually been interested first in developing a tablet known as "Safari Pad", but as noted by a number of sources including Steve Jobs himself, the company shifted gears once it became clear how revolutionary the multi-touch interface developed for the tablet could be for a smartphone. Apple's tablet wouldn't surface until the launch of the iPad in 2010, three years after the introduction of the iPhone.

Seven years after the famous Macworld 2007 keynote, the iPhone has seen significant enhancements in every area, but the original iPhone remains recognizable as Apple has maintained the overall look of a sleek design with a larger touchscreen and a single round home button on the face of the device.

Explanation:

8 0
3 years ago
Which of these might be an example of an advertisers target group
Eduardwww [97]
Where are the examples?

3 0
3 years ago
The instructions in a program ...
JulsSmile [24]

Answer:

The instructions in a program can only be expressed using a programming language

7 0
2 years ago
What type of network sends signals through airwaves and usually does not require cables?
Ira Lisetskai [31]

Wireless Networks sends signals via airwaves and usually does not need cables.

<h3>What is Wireless Networks?</h3>

A wireless network exists as a computer network that utilizes wireless data connections between network nodes. Wireless networking is a process by which homes, telecommunications networks, and business installations. A wireless network guides a computer network that creates use of Radio Frequency (RF) connections between nodes in the network. Wireless networks exist as a popular solution for homes, businesses, and telecommunications networks.

Wireless networks operate utilizing Radio Frequency (RF) technology, a frequency associated with radio wave propagation within the electromagnetic spectrum. An electromagnetic field exists generated when an RF current is supplied to an antenna that can then spread through space.

There exist three different kinds of wireless networks – WAN, LAN, and PAN: Wireless Wide Area Networks (WWAN): WWANs are created via the use of mobile phone signals typically provided and sustained by specific mobile phone (cellular) service providers.

Hence, Wireless Networks sends signals via airwaves and usually does not need cables.

To learn more about Wireless Networks refer to:

brainly.com/question/26956118

#SPJ4

7 0
1 year ago
Other questions:
  • Xml is used to format the structure and style of a web page. true or false
    7·1 answer
  • What languages do most of the students at Miami High School speak?
    6·2 answers
  • A tablet computer transmits a file over a wi-fi link to an access point.
    13·1 answer
  • What helped Taylor through her tough time with being bullied
    7·1 answer
  • Tree diagrams are useful for
    12·1 answer
  • Guys how can i video my self from my laptop <br> my laptop is (lenovo)
    8·2 answers
  • How do you change your name in the profile section because i am trying to change my name.
    9·2 answers
  • What is good work ethic?​
    11·1 answer
  • ¿Cuál es la capacidad pulmonar del hombre y la mujer?
    11·1 answer
  • (lesson 7.9: acceptance-rejection --- continuous examples.) consider the constant . on average, how many iterations (trials) wil
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!