Design and code a SWING GUI to translate test this is input in English into Pig Latin.
You can assume that the sentence contains no punctuation. The rules for Pig Latin are
as follows:
a. For words that begin with consonants, move the leading consonant to the end of the
word and add "ay". Thus, "ball" becomes "all bay"; "button" becomes "uttonbay"; and
so forth.
b. For words that begin with vowels, add "way' to the end of the word. Thus, "all"
becomes "allway"; "one" becomes "oneway"; and so forth.
Use a FLOWLAYOUT with a JTEXTAREA for the source text and separate
JTEXTAREA for the translated text. Add a JBUTTON with an event to perform the
translation. A sample application is shown next with the text translated to Pig Latin.
To parse the source text, note that you can use the SCANNER class on a STRING. For
example, the following code
Scanner scan = new Scanner ("foo bar zot");
While (scan.hasNext())
{
System.out.println(scan.next());
}
Will output:
foo
bar
zot