urgent need for code

M

madhuripearl22

HI All,

I am the new member of this group, i want code for the following
requirements.
it's urgent to me. Please send the code.

Write a code for the password checking.
specifications are as follows:

Read the password from keyboard.
1. password length should be 4-12 characters.
2. The first character should be alphabet.
3. Patterns should not repeat in the given password(Eg. if the given
password is 'cucumber' this should not be accepted because, pattern
'cu' repeated.) that pattern contains any no. of characters( 2 or
more.)
eg. if the given password is like 'cu2cumber'. then it is accepted.
because in between two 'cu' patterns there is '2' so it is acceptable.
4. If the password is accepted shpuld print the msg as "accepted"
otherwise "rejected".

please implement it in core java only, don't use jdbc connection.
 
J

Joshua Cranmer

HI All,

I am the new member of this group, i want code for the following
requirements.
it's urgent to me. Please send the code.

Write a code for the password checking.
specifications are as follows:

Read the password from keyboard.
1. password length should be 4-12 characters.
2. The first character should be alphabet.
3. Patterns should not repeat in the given password(Eg. if the given
password is 'cucumber' this should not be accepted because, pattern
'cu' repeated.) that pattern contains any no. of characters( 2 or
more.)
eg. if the given password is like 'cu2cumber'. then it is accepted.
because in between two 'cu' patterns there is '2' so it is acceptable.
4. If the password is accepted shpuld print the msg as "accepted"
otherwise "rejected".

Here's the code:

def validate(pass):
if len(pass) < 4 or len(pass) > 12:
return False
if 'a' > pass[0] or 'z' < pass[0]:
return False
for x in range(len(pass) / 2):
for i in range(len(pass)-x):
if pass[i:i+x] == pass [i+x:i+2x]:
return False
return True
please implement it in core java only, don't use jdbc connection.

Oops. Oh well, Python's close enough, right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top