Assignment 08

Due: Monday, November 9, 2015 at noon 100 points

Instructions: You know how to submit; do it in the usual way. You will submit multiple files for this programming project. The cssubmit script will work as usual, picking up all .cpp and .h and .dat files in the current directory. So, make sure you have created a separate directory for your hw 8 program. (Do not create sub-directories in the hw8 directory.)

Specifications: Your program will read in text (presumably a high-security message) from either the keyboard or from a file. Thus, the first input from the user is knowledge of whether they will input the text from the keyboard or from a file and what the name of the file is. Once known, your program is going to completely discombobulate (a homerism for "encrypt") the message using the following heuristics:

  1. Any words that end with a 'u' or a 'y', just delete them (take them out of the message).

  2. Any word that ends with the other vowels ('a', 'e', 'i', 'o'), <- remove 'e' from this list append "st" to that word.

  3. If any word contains "ion", then replace that string of characters ("ion") with "or".

  4. Any instance of "the" will be replaced with "da".

  5. For every sentence of the message, you are to reverse every other word starting with the second word. (e.g. "Hello there, I'm tired." turns into "Hello ereht, I'm derit.")

  6. Into each sentence, you will insert into a random spot (before or after any word in the sentence) a phrase chosen at random from the list of "Homerisms" listed below.

  7. Randomly choose either to append to the beginning of a sentence "I mean" or to append to the end of that sentence ", n'stuff".

Your program is to output the "encrypted" message to a file named "homerfried.dat".

Special Stuff:

  • For this assignment, you are required to use null-terminated char arrays for everything except the names of files, for which can use standard strings if you desire.

  • For this assignment, you cannot make any assumptions about the length of the input text (number of words, characters, sentences, et)

  • You must preserve punctuation, but you do NOT have to account for quotation marks (assume no input text will ever have them). note: a hyphen is not punctuation.

  • For this assignment, you are allowed to work in groups of two. That is, you can pair up with another student to work on and submit together hw 8. IF YOU DO, you can only work with another student who has the same instructor only. You will submit only under one name (one submission) but be sure to put both names in the comment headers.

  • Any input data files that you use must have a .dat extension on its name so that cssubmit will find it. (In fact, don't use any extension for a file name that we don't approve.)

  • Don't underestimate the complexities and difficulties in this assignment. It is usually the hardest program assignment of the semester.

Homerisms:

shut up Flanders

D'OH!

woo hoo!

why, you little...

mmmmmm, doughnuttttt

stupid Flanders

BART!

borrrring

When you submit: Choose to read the input text from a file in which you have typed the first five sentences of the Gettysburg Address.

Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal.

Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battlefield of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.

Furthermore, don't seed your random number generator with a constant; seed it with time.

Warning!!! DON'T COPY AND PASTE THIS INPUT TEXT FROM HERE OR ANYWHERE...because there can be hidden characters that will mess up your program's performance. Just bite the bullet and type in those sentences in a data file using jpico. If you don't take this advice, we have no sympathy for you whatsoever. NONE!

As always, if you have any questions about this assignment, as your instructor. Don't ask Homer.

Background: Homer isn't happy with his Krusty-nigma masheen that he commissioned you to build. It seems that some of the more advanced intellectual giants in the community (Barney, Ralph, Maggie, ...) can break that code. Thus, Homer wants you to write another encrypting (and this time, your program will encryt rather than decrypt) program to pass information through. This time, the masheen is really going to mash things up. It's going to turn normal English into something that only someone as stupid as Homer could understand. (See picture to the right -> )