• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fast food service program.

 
ken zemaitis
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello again.
im trying to modify some code that has been provided to me.
i am having trouble in a few areas.
1.) when using a read utility, how can i accept any instance of the word "yes?" "yes," "YES," "YeS," etc.
2.) when using a loop, how can i call on each individual value in a string to display one after another?

this is what should be displayed.


this is what i have, how can i get this to display like that? all i want to do is call on each element, i know how i can call each individual element, but what code do i use so that i can continually call them all until there are no more to call. please pay no attention to the utility call.


i would appreciate any input you could provide.
thank you very much.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ken zemaitis:
...1.) when using a read utility, how can i accept any instance of the word "yes?" "yes," "YES," "YeS," etc.

One way is to use String's toLowerCase method to standardize user input, then compare it to a lowercase String. For example...

boolean isYes = usersInput.toLowerCase().equals("yes");
Originally posted by ken zemaitis:
2.) when using a loop, how can i call on each individual value in a string to display one after another?...

It looks like you already have your Strings in the array, so you reference them by index. Within the loop, this is just items[ i ]; (I think this is what you're asking.)
 
ken zemaitis
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by marc weber:

It looks like you already have your Strings in the array, so you reference them by index. Within the loop, this is just items[ i ]; (I think this is what you're asking.)


that is what i had originally figured, but i wasnt sure. thank you for your help, saves me hours of headaches.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic