incorrect results from if statement

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 954 Views - Last Post: 03 August 2013 - 02:16 PM Rate Topic: -----

#16 ConciselyVerbose  Icon User is offline

  • D.I.C Regular

Reputation: 90
  • View blog
  • Posts: 315
  • Joined: 05-July 13

Re: incorrect results from if statement

Posted 03 August 2013 - 01:12 PM

View Poststreek405, on 03 August 2013 - 12:26 PM, said:

View PostConciselyVerbose, on 03 August 2013 - 12:17 PM, said:

ignoreCase() is not a function that I am aware of. Because your original answers you are looking for or lowercase, converting to lower case makes case a non-issue during your contains method. Is there any reason you will need the string in any other case?

Sorry, I meant isnt there a way to make the program ignore the case of whatever the user enters, in order to match it with the correct answer? Like lets say the correct answer, to match with is, hello, but for some reason the user enters HELLO or Hello.


Converting everything to lower case like he showed you did that. That is what I was trying to explain.


Quote

View PostNeoTifa, on 03 August 2013 - 12:23 PM, said:

There's an equalsIgnoreCase isn't there? I haven't done Java in like 3 years but I want to help. :(/>/> Why not just put the ingredients into a string array then loop through to check the user inputs, that way you don't have to delimit and whatnot?

That is another good idea! Thanks


Combined with the other suggestions in this thread that will work. If you were trying to use the contains method as you were earlier, it does not have the same possibility, so this is likely why it wasn't brought up earlier. I personally would probably use g00se's suggestion, which would also lend itself more easily to converting the input to lowercase.
Was This Post Helpful? 0
  • +
  • -

#17 streek405  Icon User is offline

  • D.I.C Addict

Reputation: 10
  • View blog
  • Posts: 548
  • Joined: 10-March 13

Re: incorrect results from if statement

Posted 03 August 2013 - 01:18 PM

[/quote]

Combined with the other suggestions in this thread that will work. If you were trying to use the contains method as you were earlier, it does not have the same possibility, so this is likely why it wasn't brought up earlier. I personally would probably use g00se's suggestion, which would also lend itself more easily to converting the input to lowercase.
[/quote]


His idea does seem to make more sense, but Im too lazy, at the moment to change it. :(
Was This Post Helpful? 0
  • +
  • -

#18 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2670
  • View blog
  • Posts: 15,715
  • Joined: 24-September 08

Re: incorrect results from if statement

Posted 03 August 2013 - 01:29 PM

Wow, really? Then why ask for help making your program work if you're not going to do anything about it?
Was This Post Helpful? 1
  • +
  • -

#19 streek405  Icon User is offline

  • D.I.C Addict

Reputation: 10
  • View blog
  • Posts: 548
  • Joined: 10-March 13

Re: incorrect results from if statement

Posted 03 August 2013 - 02:16 PM

View PostNeoTifa, on 03 August 2013 - 01:29 PM, said:

Wow, really? Then why ask for help making your program work if you're not going to do anything about it?

No I didnt mean it like that, I already used pbl's example to change my code. I meant that I meant that I'm to lazy to change my code to a shorter one, by using your example. I literally either right down you're guys examples in my book or comment it in my final program, for other examples.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2