CPSC 120B Fall 2003
Program 3: Gibberish
Due Wednesday, October 17

Problem

Write a program that reads in a phrase from the user and prints the gibberish equivalent of that phrase. To translate a word into gibberish, each syllable is transformed by inserting "idig" between the leading consonant sound and the rest of the syllable. If there is no leading consonant sound, "idig" is simply prepended to the syllable. Study the examples below to be sure you understand the translation.

English          Gibberish
-------          ---------
chair            chidigair
three            thridigee
ant              idigant
easy             idigeasidigy
marvelous        midigarvidigelidigous
fanatic          fidiganidigatidigic

This is reminiscent of the PigLatin program in the text, but there are a number of significant differences that you will need to attend to.

Input

One reason gibberish is harder to understand than pig latin is that it modifies every syllable. This means that your program will need to be able to tell where one syllable starts and another ends, which is not an easily automated task. To get around this, your program should allow the user to indicate where the syllable breaks are in the words that are entered by inserting a delimiter of the user's choice. For example, if the user chooses a period (.) as a syllable delimiter, he or she would then enter "doc.u.men.ta.tion" for the word "documentation". Note that if the user does not use the delimiter when entering words to be translated, only the first syllable will be transformed.

After establishing the syllable delimiter, your program should keep reading and translating phrases (using that same delimiter) until the user asks to quit. To simplify things for the translator, you should require that the phrases entered contain only letters, spaces, and delimiters. If the user enters a phrase containing other characters, the program should ask for another phrase until it gets one with only legal characters.

Output

Your program should print the gibberish equivalent of each phrase entered, neatly labeled, all lower case.

Program Structure

You will need two classes for this program: GibberishTranslator (the translator) and Gibberish (the main program). There are a number of things to think about for each:

Sample I/O

A single run of your program might look like this:
*** Welcome to the Gibberish translator!! ***
Enter the character that will delimit syllables: .

Enter phrase: This is a test
Your phrase in gibberish:
thidigis idigis idiga tidigest 

Translate another phrase? (y/n) y
Enter phrase: Gib.ber.ish is ve.ry strange
Your phrase in gibberish:
gidigibbidigeridigish idigis vidigeridigy stridigange 

Traslate another phrase? (y/n) y
Enter phrase: I don't like this!
Phrase contains illegal characters, enter again: Goodbye
Your phrase in gibberish:
gidigoodbye

Traslate another phrase? (y/n) n

Bidigye!

Documentation and Style

Provide a program header that gives your name, the name of the file, and a description of the program. Also provide a header for each method that gives its name, its parameters, and its return value, and briefly explains what it does. Use good names for variables and constants, and use an explanatory comment whenever a portion of code might not be clear to the reader. Also be sure to follow the capitalization conventions discussed in class.

What to Turn In

Turn in hardcopy of your program and e-mail the source code to bloss@roanoke.edu. Put cs120 prog3 in the subject line. Both the hardcopy and the e-mail are due by 4:00 on the date above.