• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help me with "password strength meter" program  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried to write a code, but it didnt work please help me! here is my code:
 
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
obaid ali wrote:i tried to write a code, but it didnt work please help me!

Could you tell us how it didn't work? If you have error messages please post (cut and paste) them. If you are not getting the results you want, tell us what you entered, what were the results, and what results were you expecting.
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One problem I see is that you use the "reader" to get a line and put it into a String variable called "password". So far, so good. However, you continue to use reader to get characters when instead you should be looking at individual characters already contained in "password".
Example
 
obaid ali
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown wrote:One problem I see is that you use the "reader" to get a line and put it into a String variable called "password". So far, so good. However, you continue to use reader to get characters when instead you should be looking at individual characters already contained in "password".
Example


When i compile an input more than 7 letters it won't show me an output. Can you please edit my code or help me?
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I am afraid I can see one problem: you have got too much in the main method, which should be 1 statement long. You need to move things like input, checking the password, an displaying its score, into different methods. Probably in a different class.
 
Sheriff
Posts: 4289
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

As Carey Brown said, this is incorrect. You have already gotten the password in the variable password. You should create a loop to visit each character one by one in password, probably a "for" loop. Then use the code Carey gave you to test the individual characters.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!