Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 StringTokenizer Question
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Raza




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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)?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
chili5




PostPosted: 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.
Raza




PostPosted: 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.
Tony




PostPosted: Tue Mar 17, 2009 7:38 pm   Post subject: RE:StringTokenizer Question

the words used to be intact earlier on in the program.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: