TLP - Programming Maintenance
Week 12 - Watch you talking about Willis?
Background
Ok, I'm going to show my age here. When I was a kid there was a popular TV show called Zoom (yes, it made a comeback a few years ago. It wasn't the same.) One of the things that was a frequent occurrence on Zoom was people talking in Ubbi Dubbi [more about the language from Wikipedia].
Translated, what she is saying is:
"And now for today's weather. Get out the shovels, Because it's gonna snow! This has been Another Ubbi Dubbi Weather Update. Brrr..."
And for those of you would would prefer I stick with my Big Bang Theory references, they talked about Ubbid Dubbi too.
We are going to create a program that will translate a sentence into a similar language that we will call Gibberish.
The rules of Gibberish are simple:
- The user defines two simple syllables that will be inserted into words:
- For this demo let's insert "ib" and "al"
- The first syllable is inserted before the first vowel "cluster" in the word.
- The second syllable is inserted before each additional vowel "cluster"in the word.
If our two Gibberish syllables were “ib” and “al” some samples would be:
Original | Translation | Why |
---|---|---|
program | pribogralam | Insert the "ib" before the "o" and the "al" before the "a" |
blue | blibue | Insert the "ib" before the vowel cluster "ue" |
Mississippi | Mibissalissalippali | Insert the "ib" before the first i and the "al" before each additional "i" |
the | thibe | Insert the "ib" before the "e." Note, unlike our earlier vowel detection code we do count a trailing e as a vowel. |
early | ibearlaly | Insert the "ib" before the vowel cluster "ea" and the "al" before the y (which we treat as a vowel in this language). |
Task
-
Create a function called: translateWord()
This function should:
- Take in three parameters:
- the original word
- the first new syllable
- the second new syllable
- Actions:
- Translate the word as described above
- Hint, the hardest part of this may be knowing if when you find a vowel cluster you are to add the first or second syllable.
- This sounds like a good place for a boolean flag
- Returns:
- The translated word
- You may assume:
- For now you may assume that all words are in all lower case letters and may ignore capitalization.
- Example runs:
- Take in three parameters: