Tuesday, March 10, 2015

Warm up 3

Task: Create a piglatin Translator with the following rules
  1. If the English word begins with a vowel ("a", "e", "i", "o", "u"), add "yay"to the end of the word to produce the Pig Latin translation.

  1.  If the English word begins with a consonant (a non-vowel), move all leading consonants to the end of the word and add "ay" to produce the Pig Latin translation. You should treat the letter `y' as a vowel when it occurs after the first character in a word. You should also treat the letter pair "qu" together as a consonant. Here are some examples.
English
Pig Latin
yes
esyay
example
exampleyay
bygone
ygonebay
test
esttay
quiz
izquay
strip
ipstray
trips
ipstray
schnitzel
itzelschnay
rhyme
ymerhay






This assignment was fairly simple however, some parts proved to be a challege. One problem I faced was I could not use one "for loop" when iterrating through the word or phrase. To solve this problem I created a second array called, "constanant" and used of second "for loop" to iterrate though the word or wo for a non-vowel. Another problem was I was not able to print the translated word onto a single pane, instead it has multiple.

No comments:

Post a Comment