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");
Please rename attached 602302-EnglishToPigLatin.java to EnglishToPigLatin.java before you compile the code. You can compile and execute the program at command line by following these steps.
It is assumed that input text does not contain any punctuation symbols and words in input are separated by single space. JTextArea properties are set to wrap words at the area boundary. Java version 1.7.0_04 was used during development and testing of the attached program.