While loops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 4

While loops

I’m suppose to be doing a while loop/try/catch statements In My confusing final project that is creating an authentication system with the user being able to try 3 times before being forced to exit. While also using a MD5 hash. And we haven’t even gone over MD5 yet. Any help would be appreciated, because I’m stuck at the whole loop/try catch part

25th Feb 2018, 12:55 PM
Destiny Watts
Destiny Watts - avatar
29 Answers
+ 5
I wanted y’all to know I got a B on that final :)
4th Mar 2018, 12:20 PM
Destiny Watts
Destiny Watts - avatar
+ 4
You forgot to mention the language. And did you try anything and failed or don't know how to start?
25th Feb 2018, 1:06 PM
Alex
Alex - avatar
+ 3
Good job!
4th Mar 2018, 12:28 PM
Alex
Alex - avatar
+ 2
I've sent the eclipse project file to you. I know everyone has it's own way of codding.... but I hope it's helpful.( at least the comments should be) btw : the valid passwords are 'java' / 'code' / 'Destiny' / and of course 'Farshaad'. ;)
25th Feb 2018, 6:40 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 1
hey I don't know if that's the problem. but after coping ur code in eclipse I found some problems. the first one was that u r missing on curlybrace at the end of the code (for "FinalProject" class) then the other thing was that u don't increment the "atempts" variable ,cussing an infinite loop even if the text file couldn't be found.
25th Feb 2018, 2:16 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 1
Thank u!!!
25th Feb 2018, 7:00 PM
Destiny Watts
Destiny Watts - avatar
+ 1
I’ll look at it when I get home.
25th Feb 2018, 7:01 PM
Destiny Watts
Destiny Watts - avatar
+ 1
The file didn't download properly. When I opened it, it stated that it contained binary code and if I wanted to open it. When I opened it it was "s¼8áW8|œÙ OZªœËÚÕf⬜��B ¡Ÿ’¾Ö¼‚ÇpS‡N“Ù܇¾� ±%6¼znsµØÊ è↑ÁM�&œ8)0žogê2'P (ÚªýFÙ5…v6PpÞ`Ší”mãj͸J²Ê{6>Ô™Á¯¬‘J…^çè—#†Ä=ÜjòŒyÁ*q¬Êê7ÁÁZö¤¦£‡¬:ý]s£ 9îòQ"
25th Feb 2018, 8:25 PM
Destiny Watts
Destiny Watts - avatar
0
I apologize its Java. I have the beginning on my computer because it’s a good way through the program. I’m confused on how to put user credentials into a while statement
25th Feb 2018, 1:16 PM
Destiny Watts
Destiny Watts - avatar
0
I didn't use Java a lot yet, but it seems like the same question was asked on stackoverflow https://stackoverflow.com/questions/39809924/how-do-i-use-md5-to-convert-passwords-and-check-a-users-credentials-against-val There is a solution in the comments, but make sure you understand what's going on and not just copy the code.
25th Feb 2018, 1:25 PM
Alex
Alex - avatar
0
can u send your code here (in play ground) so we have something to start on?
25th Feb 2018, 1:30 PM
Farshaad Heydari
Farshaad Heydari - avatar
0
https://code.sololearn.com/cA8hkFmWeIO3/#java farshaad heydari Can you reach that link? I'm about to go to work, so any help would be amazing
25th Feb 2018, 1:39 PM
Destiny Watts
Destiny Watts - avatar
0
sorry didn't understand it much.... but are u sure that u r checking if the file"credentials.txt". has next line. to read? and execute while ?
25th Feb 2018, 1:55 PM
Farshaad Heydari
Farshaad Heydari - avatar
0
In all honesty I got a lot of the code from my professor and I had to fill in where the comments are. His part of the code is putting in the file, and I’m not sure how to reference it or make it read it. When I get home from work I’m going to have to try more things but I’ve been working on this for a week and can’t get any farther
25th Feb 2018, 1:58 PM
Destiny Watts
Destiny Watts - avatar
0
well don't give up.... btw. what error is shown when executing this code on ur computer?
25th Feb 2018, 2:00 PM
Farshaad Heydari
Farshaad Heydari - avatar
0
A lot of my issues is finishing up he code so I can turn in a working projects. Right now when I input he username and passwords it’s not using the hash and I am unsure how to code the hash into it
25th Feb 2018, 4:12 PM
Destiny Watts
Destiny Watts - avatar
0
I was working on the code in eclipse..... can u send the original code that ur professor gave to u? I think I'm getting there . ..,.
25th Feb 2018, 4:19 PM
Farshaad Heydari
Farshaad Heydari - avatar
0
At the moment I’m at work I can try
25th Feb 2018, 4:21 PM
Destiny Watts
Destiny Watts - avatar
0
Do u have an email I could forward it to?
25th Feb 2018, 4:24 PM
Destiny Watts
Destiny Watts - avatar
25th Feb 2018, 4:26 PM
Farshaad Heydari
Farshaad Heydari - avatar