This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
  • New Topic

Need help please!!

 
Rose Evans
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Report post to moderator
Ok you smart java guys. You helped me so well with my last problem, I have another question to ask you.
I am trying to write a program like this..

if the sentence ends with an even number of characters
and a question mark, it will output the word 'Yes'.
If the sentence ends with a question mark and it is an
odd number of characters, it will output the word 'No'.
If the sentence ends with an exclamation mark, the output
will say 'Wow!'. In all other cases, it will output
'You always say that.'

I almost have it written, but I cannot figure out a way to make it 'stop' when I want it to. Like, after it answers a question and says yes, I want it to stop, right now after it answers the question, it also displays the 'Wow" and 'You always say that' also.
Also, it is answering yes when I put a period at the end of the sentence and if a period is at the end of the sentence it should just say, 'you always say that'.

Any suggestions. I'd appreciate your help.

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Rose, this is the third time you posted a question that was NOT a servlets question in the servlets forum.

The last two, I was nice to move for you to the correct forum, Java In General (Beginner). For this one, I am just going to close it and let you post it in the correct forum.

Thanks

Mark
 
    Bookmark Topic Watch Topic
  • New Topic