While loops | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
- 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 Respostas
+ 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
0
yup... farshaadhdr@gmai.com
25th Feb 2018, 4:26 PM
Farshaad Heydari
Farshaad Heydari - avatar