Assignment 3

Due 11pm Thursday, August 2

This program has fewer new concepts, but is of increased complexity - you will want to write functions to properly do it, and they should help prevent your brain from exploding.

Write a program that reads a file of text and prints out a pig-latin translation of that file. Pig latin is constructed according to the usual rules - which can be found at http://en.wikipedia.org/wiki/Pig_Latin. Please ask the user to type in the name of the file to be translated.

Note that this is a problem that initially seems easy, but turns out to have some tricky cases, such as dealing with "qu" and with vowels versus consonants and, if you want to be really tricky, voiced h versus silent h at the beginning of a word - "hack" becomes "ack-hay", but "honesty" should be "honesty-ay".

Here is a sample file:

Stunned Cubans nervously contemplated a future without Fidel Castro after the
leader who has dominated political life for nearly 50 years stepped aside with
a serious illness.  Quietly quipping.  (What?)  Sly psycho!  Honest people
hone their hair for their heirs - didn't you know?

Call me Ishmael.

Here is a sample input session using that file, which is called "article":

What file would you like to translate?
article
unned-Stay ubans-Cay ervously-nay ontemplated-cay a-ay uture-fay ithout-way idel-Fay astro-Cay after-ay e-thay
eader-lay o-whay as-hay ominated-day olitical-pay ife-lay or-fay early-nay 50 years-ay epped-stay aside-ay ith-way
a-ay erious-say illness-ay. ietly-Quay ipping-quay. (at-Whay?) y-Slay ycho-psay! onest-Hay eople-pay
one-hay eir-thay air-hay or-fay eir-thay eirs-hay - idn't-day you-ay ow-knay?

all-Cay e-may Ishmael-ay.

Note that in this example, I don't deal with the "silent h" problem. This is okay. Any program that was able to give the above output for the given input would almost certainly get an A.

Good luck!

Boilerplate

Ask me if there are any questions, and remember that elegance counts! peter@cs.uoregon.edu, or simply commenting below will all reach me immediately. Also recommended is coming in to office hours if you have any questions.

Turn It In

Turn your project in using the following form:

What is your student #?
What is your name?
What is your email?
What file would you like to submit?
If you have more than one file in your project, please use an archiving tool to put them all into one archive file. Acceptable archive types are .zip, .jar, .tar, and .tgz.

Please make sure that you provide any README files in plain text. MS Word .doc files are not acceptable. .html, .txt, .ps, .dvi, and .pdf are all acceptable. Really you should just be turning in ASCII text (.txt) files and source code. And for most assignments, just well documented source code.

Comments and Clarifications

The admin should touch /cs/classweb/07U/cis122/3/index.comment

Questions? Answers!
Valid CSS! Valid XHTML 1.1!