Computer Science Canada

StringTokenizer Question

Author:  Raza [ Tue Mar 17, 2009 6:06 pm ]
Post subject:  StringTokenizer Question

Quote:
Write program called VowelRemover that ask the user to enter a sentence and replaces all the vowels in the sentence with *. In addition, it converts successive words into upper, lower, upper case pattern.

e.g. The sky looks cloudy today. It is not a good day to go out.

TH* sky L**KS cl**dy T*D*Y. *t *S n*t A g**d D*Y t* G* **t.


I get the question and I'm done for the most part. The part that screws me up is when there are two vowels in a row.
We're supposed to use StringTokenizer and possibly StringBuffer class for this. Help?

Author:  Tony [ Tue Mar 17, 2009 6:36 pm ]
Post subject:  Re: StringTokenizer Question

Raza @ Tue Mar 17, 2009 6:06 pm wrote:
The part that screws me up is when there are two vowels in a row.

How is that case different from there being just one vowel (or three)?

Author:  chili5 [ Tue Mar 17, 2009 6:42 pm ]
Post subject:  RE:StringTokenizer Question

I agree, how is that any different?

If you have code that replaces one vowel. It should work for any vowel.

Author:  Raza [ Tue Mar 17, 2009 6:59 pm ]
Post subject:  Re: StringTokenizer Question

Um.. alright. So I got how to do two vowels. Now the upper and lower case thing really screws me up.

Any ideas there? Because I ended up dividing it into seperate tokens, and test a e i o u for each one. Then when I implement the uppercase lowercase if statements, it ends up looking like

TH* sky L**ks CL**dy T*d*Y.

for obvious reasons. Because I go Uppercase>lowercase>uppercase, and so on, after each token. I can't keep the words intact.

Author:  Tony [ Tue Mar 17, 2009 7:38 pm ]
Post subject:  RE:StringTokenizer Question

the words used to be intact earlier on in the program.


: