Design and code a swing gui to translate text that is input


Question: Design and code a Swing GUI to translate text that 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 "button bay"; and so forth.

Use a Flow Layout with a J Text Area for the source text and a separate J Text Area for the translated text. Add a J Button 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

Code: Scanner scan = new Scanner("foo bar zot");

while (scan.hasnext())

{

   System.out.println(scan.next());

}

will output

foo

bar

zot

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Design and code a swing gui to translate text that is input
Reference No:- TGS02405457

Now Priced at $10 (50% Discount)

Recommended (95%)

Rated (4.7/5)