Write a program with a method called passwordCheck to return if the string is a valid password. The method should have the signature shown in the starter code.
The password must be at least 8 characters long and may only consist of letters and digits. To pass the autograder, you will need to print the boolean return value from the passwordCheck method.
Hint: Consider creating a String that contains all the letters in the alphabet and a String that contains all digits. If the password has a character that isn’t in one of those Strings, then it’s an illegitimate password!
Coding portion:
public class Password
{
public static void main(String[] args)
{
// Prompt the user to enter their password and pass their string
// to the passwordCheck method to determine if it is valid.
}
public static boolean passwordCheck(String password)
{
// Create this method so that it checks to see that the password
// is at least 8 characters long and only contains letters
// and numbers.
}
}

Answers

Answer 1

Answer:

import java.util.regex.*;

import java.util.Scanner;

public class Password

{

  public static void main(String[] args) {

  Scanner input = new Scanner(System.in);

  System.out.println("Please enter the Password. \n");

  String passwordString = input.next();

  System.out.println(passwordCheck(passwordString));

  }

  public static boolean passwordCheck(String password){

  if(password.length()>=8 && password.matches("[a-z0-9A-Z]+")){

  return true;

  }

  else{

  return false;

  }

  }

}

Explanation:

The Java class "Password" is used by the program to make an instance of the password object and check its validity with the passwordChecker method defined within the Password class. The passwordChecker method only matches alphanumeric passwords, that is, passwords with alphabets and numbers. If a non-alphanumeric character is encountered, the boolean value false is returned.


Related Questions

2. When You buy 4 GB memory unit (pendrive) you
will get memory less than 4 GB?​

Answers

Answer:

Yes.

Explanation:

I believe so, because the pendrive takes some storage for it to actually function. If they wanted it to have exactly 4 GB of memory, they would have to add extra memory.

C:/Users/Documents/resume.docx Where is the "resume" document located in this file structure?

Answers

Answer:

"resume.docx" is located in "Documents"

Explanation:

[<drive-letter:: represents drive name>]:/Main_Directory/Sub_Directory/ETC..

The  "resume" is located in the "Documents" according to the file structure.

Given the information C:/Users/Documents/resume.docx, this can be interpreted as Documents is in the Users folder and the resume can be found in the Document folder.

We can also say that the document folder was created by the user and the "resume" file is placed directly into the documents.

Based on the explanation, we can say that the  "resume" is located in the "Documents" according to the file structure.

Learn more here: https://brainly.com/question/13715153

8. T/F: At the bottom of a slide you are working on you can enter notes to indicate what yo
True
False
« BACK
LESSON 8.1 - INTRO TO PRESENTATIONS

Answers

Answer: True. Hope it helps!

Which of the following scenarios is most likely to give you the shallowest depth of field?
a) 18mm lens at f5.6, subject 20 feet away.
b) 50mm lens at f22, subject 6 feet away.
c) 28mm lens at f4, subject 15 feet away.
d) 85mm lens at f2, subject 8 feet away
50 points and brainliest

Answers

Answer: The answer is B    Hope this helps :)   Please mark Brainliest

Explanation:

What’s the term for a current flow in which electrons move in one direction

Answers

Answer:

Direct Current

Explanation:

MARK ME BRAINLIEst pls

write algorithm and flowchart to calculate sum,difference, product and quotient of two integer number given by the user.​

Answers

Answer:

Step1: Start

Step2: Initialize the count variable to zero

Step3: Initialize the sum variable to zero

Step4: Read a number say x

Step 5: Add 1 to the number in the count variable

Step6: Add the number x to the sum variable.

Step7: Is the count variable in the memory greater than 50?

           If yes, display the sum: go to step 8.

           If No, Repeat from step 4

Step8: Stop

Explanation:

To make a window wider, you would move the pointer until it changes to the horizontal resize shape and then

Answers

Answer:double click it .

Explanation:

Which of the following calculates to 10?
3*(6+2/2)
(3* 6) + 2/2
(3* 6+ 2)/2
3*6+2/2

Answers

Answer:

C. (3* 6+ 2)/2

Explanation:

Arithmetic operation are performed sequentially using the rule known as bracket of division, multiplication, addition and subtraction (BODMAS).

(3* 6 + 2)/2

Simplifying the above mathematical expression, we have;

(18 + 2)/2

= 20/2 = 10

Jordan uses a spreadsheet to keep track of how many hits each player on a baseball team has had in each game
throughout the season. For every game, each player's name appears in a column that Jordan has titled "Player."
Next to that, a column titled "Hits" shows the number of hits for each player in a single game.
What function should Jordan use to find the average number of hits per game for player A_Clemente?
O SUMIF(Hits, "A Clemente", Player)
O SUMIF(Player, "A Clemente". Hits)
O AVERAGEIF(Hits, "A Clemente", Player)
O AVERAGEIF(Player,"A_Clemente", Hits)

Answers

Answer:

AVERAGEIF(Player, "A_Clemente", Hits)

Explanation:

The AVERAGEIF function allows users to calcule the mean value of numerical columns while also Given certain constraints within a single function call. The AVERAGEIF takes in 3 arguments.

The first is a column which houses the range of the constraint we would like to apply on our function.

The second argument is the constraint itself which should reside within the values in the range defined in the first argument.

The third argument is the numerical column whose average is calculated based on the defined constraint.

Therefore, in the scenario above, Player is the column containing player names, which it's value will later be used as a constraint

"Clemente_A" the constraint, only values pertaining to Clemente_A will be defined.

Hits, the numeric column whose value is averaged based on the constraint given.

A device is sending out data at the rate of 1000 bps. How long does it take to send
out (a)10 bits, (b) a single character (8 bits) and (c)100,000 characters?

Answers

Answer:

0.01 second ; 0.008 seconds; 800 seconds

Explanation:

Given that:

Sending rate = 1000 bps

Rate of 1000 bps means that data is sent at a rate of 1000 bits per second

Hence, to send out 10 bits

1000 bits = 1 second

10 bits = x

1000x = 10

x = 10 / 1000

x = 0.01 second

2.)

A single character 8 - bits

1000 bits = 1 second

8 bits = (8 / 1000) seconds

= 0.008 seconds

3.)

100,000 characters = (8 * 100,000) = 800,000

1000 bits = 1 second

800,000 bits = (800,000 / 1000)

= 800 seconds

One of the following is NOT a basic linked list operation:_________.
a) search
b) insert
c) create
d) delete
e) traverse
f) destroy
g) build list from file

Answers

Answer:

One of the following is NOT a basic linked list operation:_________.

g) build list from file

Explanation:

Linked list operation is the creation of trees and graphs or a chain of data elements, which are called nodes.  Each note points to the next using a pointer.  In linked lists, each node consists of its own data and the address of the next node.  A linked list, which may be single, double, or circular, forms a chain-like structure that builds from one node to the other.

What is the name of the variable in the
following code?

Answers

Answer:

Lift

Explanation:

When coding, you use a variable name for an object, and assign it to move up, down, and/or sideways.

Lift is the answer for that
Other Questions
In the Month of March, Baldwin Corporation received orders of 147 units at a price of $15.00 for their product Bill. Baldwin uses the accrual method of accounting and offers 30 day credit terms. Baldwin delivers 98 units in March and the balance of 49 units in April. They received payment for 49 units in March, 49 units in April, and 49 units in May. How much revenue is recognized on the March income statement from this order Your cell phone provider charges a monthly fee of $30. You are also charged $0.07 per minutefor each minute. Last month, Mr. Gonzales' bill was $59.40. Let m represent the total numberof minutes Mr. Gonzales used last month. Use the verbal model below to write an equation. If 3 times the difference of x and y is -30, and 2/3 of x plus 1/2 of y is 19, what are x and y However, motors are designed so that the polarity of the electromagnet constantly flips. That is, the north pole becomes thesouth pole, and the south pole becomes the north pole, every time the electromagnet turns 180 degreesWhy is it designed this way?OA.OB.Oc.OD.to conserve the energy in the batteryso the magnetic field will get strongerso the electromagnet will continuously turnto constantly polarize the field magnet The fastest revolving planet around the sun?options..a)earthb)marsc)jupiterd)saturn Identity the connection between each pair of words The opening and closing of _____________in your heart create the lub-dub sound and prevent the backflow of blood.What goes in the blank? PLZ HELP IM TAKING MY EXAM!! which of the following best explains the impact of mrna being double stranded before translation Multiple ChoiceComplete each sentence with the most appropriate vocabulary word or verb conjugation. PLEASE HURRY. 24. Factor completely(1 Point14x^3 16x^2 + 21x 24 What is the numerical expression of 28 Rewrite the following formal sentence in a more conversational style. This may require the use of more than one sentence. Make changes to bothsentence structure and word choices.It ill becomes us to cast about for someone to blame, to flee unpleasant realities,or to hide the clear facts in a cloud of finger-pointing-we must take responsibility. What is the value of p?I dont know how to do this How does the ballerinas attitude toward her kickboxing class change? Include examples from the last six stanzas of the poem to support your answer. from the poem "New Moves"30 points to whoever answers there are four children in Jana's family. She is less than 11 years old and is the oldest. there's a two-years age difference to twins, riya and seta, who come next. yuvi who is older than 5 is 2 years younger than the twins. how old are each of the children? 80 Points someone please help emergency!! Mike and Joe each receive money for their lunch. Mike receives $100 and spends $3 each day on his lunch. Joe receives $20 and then an additional $5 each day. Joe saves hismoney and does not buy lunch. How many days will it take for Mike and Joe to have the same amount of money? Select the one statement that is true#1: More soldiers deserted the military than fled to Canada #2:The number of Canadians who fought in Vietnam exceeds the number of American soldiers killed in Vietnam.#3: Boys outnumbered Girls who immigrated to Canada during the Vietnam war.#4: Canada readily accepted deserters during the Vietnam-war era. Find the cost of tiling a rectangular plot of land 300 m long and 150 m wide at the rate of $6 per square m. 2.15 divided by 38 =?