Talk Like A Pirate. Arrr.

Overview

An important and common use for computer science ideas is for translating or converting text from one form, or one language, to another. Tools like Babel Fish will convert text from one language to another. Compilers convert computer programs from one programming language to another. For this assignment, you'll create a computer translator that will take text and convert it to pirate-speak. You'll be ready to go for International Talk Like A Pirate Day!

Specifics

Your mission is to create a program to convert English to Pirate. Create a directory called pirate for your code, and name your program Pirate.java. Specifically, here are some rules to follow:

  1. Replace words as follows. hello -> ahoy; hi -> yo-ho-ho; my -> me; friend -> bucko; sir -> matey; miss -> proud beauty; stranger -> scurvy dog; officer -> foul blaggart; where -> whar; is -> be; the ->th'; you -> ye; old -> barnacle covered; happy -> grog-filled; nearby -> broadside; restroom -> head; restaurant -> galley; hotel -> fleabag inn. Feel free to add more if you like, but embellish this later: this is the easy part. You might want to get this working with just a few words, do the rest of the assignment, then come back to finish this for fun.

  2. Pirates have a habit of saying "Arrr" a lot. Get your translator to randomly insert "Arrr." between sentences. Anytime you encounter the end of a sentence (as denoted by a period, question mark, or exclamation point), decide with a 50/50 chance whether to insert an "Arrr."

You should assume that your source file has no punctuation in it, to keep it simple. If you want an extra challenge, assume there is punctuation only at the end of each word, and try to pull it off.


Many thanks to David Reed at Creighton University for the idea for this assignment!