Pig Latin
Write a main()
program that has the user enter two words: one that begins with a consonant, one that begins with a vowel. Then print out the Pig Latin version of that word according the following rules:
- Words that begin with a consonant sound have that sound moved to the end of the word, with an "-ay" added to the end of the word.
- Words that begin with a vowel have the consonant "w" added to the end of the word, followed by an "-ay" at the end.
Thus:
- "lunch" becomes "unch-l-ay", or rather "unchlay" (without the hyphens)
- "sunset" becomes "unsetsay"
- "egg" becomes "egg-w-ay", or "eggway" (without the hyphens)
- "awful" becomes "awfulway"
Your main()
program should call a String
method convert()
that takes a single String
parameter and returns the Pig Latin version of that word.