Experienced Java Developer , Please Help ! - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Experienced Java Developer , Please Help ! (1376 Views)
| Experienced Java Developer , Please Help ! by shegzhkn(op): 12:17am On Dec 26, 2019*. Modified: 10:48pm On Jan 02, 2020 |
CLOSED |
| Re: Experienced Java Developer , Please Help ! by stanliwise(m): 12:46am On Dec 26, 2019 |
shegzhkn:I didn't read your code sha. but once you randomize throught the questions, for each you have selected, just delete from the the array and stor it in another array. List_of_questions answered_questions. use Arraylist data structure, it is more flexible. |
| Re: Experienced Java Developer , Please Help ! by crunchyDope(m): 12:49am On Dec 26, 2019 |
[quote author=shegzhkn post=85220614][/quote]what error(s) are you getting? |
| Re: Experienced Java Developer , Please Help ! by shegzhkn(op): 1:06am On Dec 26, 2019 |
crunchyDope:Maybe you should run the code sire , at some point am getting null pointer exception , your input is appreciated sire. |
| Re: Experienced Java Developer , Please Help ! by shegzhkn(op): 1:07am On Dec 26, 2019 |
stanliwise:Lol, well we've said you didn't read the code, i did utilize it anyways and you might want to take a close look at it. |
| Re: Experienced Java Developer , Please Help ! by Nobody: 5:14am On Dec 26, 2019 |
Not readable, sorry I can't contribute. Next time, add comments for easy reading. |
| Re: Experienced Java Developer , Please Help ! by shegzhkn(op): 8:17am On Dec 26, 2019 |
2kaybiel:Goddammit , can i reach you through other medium , walai NL has long way to go - if nairaland had special code input blueprint we won't be having this conversation. |
| Re: Experienced Java Developer , Please Help ! by lincsnuel: 8:20am On Dec 26, 2019*. Modified: 8:47am On Dec 26, 2019 |
shegzhkn:Your problem lies here: while (numbies.size() <= questions.length) { Remove "<=" and use only "<" or use: while (numbies.size() <= (questions.length -1)) { Remember arrays start from 0, this implies that the first Question object is assigned the value 0. Since your arraylist is 10 (i.e 0-9), then numbies should be less than questions.length |
| Re: Experienced Java Developer , Please Help ! by lincsnuel: 8:30am On Dec 26, 2019 |
To avoid repetition, create a new ArrayList maybe, answerList and for any question answered, remove from questions and store in answerList. The Random object will then randomly pick from the ones in question not already answered. There's another way but try this one. |
| Re: Experienced Java Developer , Please Help ! by shegzhkn(op): 8:45am On Dec 26, 2019 |
lincsnuel:Thanks boss man , God bless. |
| Re: Experienced Java Developer , Please Help ! by crunchyDope(m): 8:47am On Dec 26, 2019 |
shegzhkn:just ran your code the bug is in the "take test" method you initialized your random questions to 10 but when you create a random question you save it to just the first index (0) because you keep initializing "count=0" over again solution place "int count = 0 " outside the iteration goodluck |
| Re: Experienced Java Developer , Please Help ! by shegzhkn(op): 8:50am On Dec 26, 2019 |
crunchyDope:Thanks boss , i really appreciate. Coding can be really crazy , after quite sometimes of drinking coffee(Java) i still made such a simple error - keep giving count value of zero after every iteration and it never crossed my mind after several attempt to debug . Once again thanks. |
| Re: Experienced Java Developer , Please Help ! by stanliwise(m): 11:36am On Dec 26, 2019 |
shegzhkn:Next time you paste coding problems, please place the error messages. Not everyone has time to run your codes especially when it has dependencies or compatibility requirements. |
| Re: Experienced Java Developer , Please Help ! by shegzhkn(op): 11:45am On Dec 26, 2019 |
stanliwise:Affirmative sire, thanks. |
| Re: Experienced Java Developer , Please Help ! by crunchyDope(m): 4:44pm On Dec 26, 2019 |
shegzhkn:it happens to everyone |
Difference Between A Software Developer And A Web Developer... Please • Java Developer Required For Mifos X Customisation • Java Developer Needed • 2 • 3 • 4
, new Question(q2, "b"