Create a method which receives a String, then converts the String to Pig Latin, and returns the new Pig Latinated word. There may be multiple words in the String, so it is necessary to have a recursive function that breaks down the string into single words and then reconstructs the phrase in Pig Latin.
1. if there are no vowels in englishWord, then the pigLatinWord is just englishWord + "ay". (there are 10 vowels: AaEeIiOoUu, y isn't a vowel.)
2. Else, if englishWord begins with a vowel, then pigLatinWord is just englishWord + "yay".
3. Otherwise (if englishWord has a vowel in it and yet doesn't start with vowel), then pigLatinWord is end + start + "ay", where the end and start are defined as follows:
a) let start be all of the englishWord up to but not including its first vowel.
b) let start be all of the englishWord from its first vowel on.
c) but if englishWord is capitalized, then capitalize end and "uncapitalize" start.
Please help, this method is really difficult
Thank you
2007-03-19
17:29:16
·
4 answers
·
asked by
jumba
1