Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help please!!

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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