Purchase Solution

Java program to convert English text to Pig Latin

Not what you're looking for?

Ask Custom Question

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

Purchase this Solution

Solution Summary

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.

Solution Preview

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.

[~] ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Javscript Basics

Quiz on basics of javascript programming language.