java.lang.ArrayIndexOutOfBoundsException: 10 error hangman

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 584 Views - Last Post: 05 May 2013 - 04:59 PM Rate Topic: -----

#16 Tigers27  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 25-March 13

Re: java.lang.ArrayIndexOutOfBoundsException: 10 error hangman

Posted 05 May 2013 - 11:01 AM

View PostGregBrannon, on 05 May 2013 - 09:55 AM, said:

So perhaps the while loop beginning at line 27 should check for more than the number of wrong guesses. You could create another flag, wordGuessed?, that starts out false but goes true in the same while loop if the user guesses the word.

How would you check to see if the word has been guessed?

How would you modify the while loop to check the wordGuessed flag?

would I just have wordGuessed in the while loop?
Was This Post Helpful? 0
  • +
  • -

#17 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: java.lang.ArrayIndexOutOfBoundsException: 10 error hangman

Posted 05 May 2013 - 11:22 AM

Well, that's a start, but by itself wouldn't be enough. You'd also want to include some logic that changes wordGuessed from false to true, an 'if' statement maybe, and you'd want to include wordGuessed as part of the while condition.
Was This Post Helpful? 0
  • +
  • -

#18 Tigers27  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 25-March 13

Re: java.lang.ArrayIndexOutOfBoundsException: 10 error hangman

Posted 05 May 2013 - 04:59 PM

View PostGregBrannon, on 05 May 2013 - 11:22 AM, said:

Well, that's a start, but by itself wouldn't be enough. You'd also want to include some logic that changes wordGuessed from false to true, an 'if' statement maybe, and you'd want to include wordGuessed as part of the while condition.


Ah, this is so hard for me to understand right now. I've worked on this problem for about 40 hours in 2 weeks haha. ugh.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2