File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Need help please!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

Need help please!!

Rose Evans
Ranch Hand

Joined: Oct 14, 2004
Posts: 195
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

Joined: Feb 05, 2001
Posts: 17276

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.



Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Need help please!!
It's not a secret anymore!