Computer Science Canada Need help with do loop. |
Author: | Kenster102.5 [ Tue Nov 11, 2008 7:22 pm ] | ||
Post subject: | Need help with do loop. | ||
I am creating this program for school board selection which uses a do loop. The user must choose either Catholic school board which is represented by "C" or Public school board which is represented by "P". The users is prompted within the do loop, and the users entry is stored as type character. A case will be used to tell the user their selection. The loop will constantly run until if they enter the incorrect information, but should stop once "C" or "P" is entered, but it doesn't and continues to ask the user. Written with Ready to Program Java IDE
Can I use OR operator, or do I have to create another do loop for the second character? |
Author: | HellblazerX [ Tue Nov 11, 2008 7:36 pm ] | ||
Post subject: | Re: Need help with do loop. | ||
You need AND:
Otherwise you won't be able to exit the loop unless schoolBoard is equal to both P and C at the same time. |