There are two parts to this assignment:
Don't have one of you do the easy part and the other do the hard part. Work with your partner on both parts!
If you are unfamiliar with cryptograms, Wikipedia has a reasonable explanation, and you can try some out at Puzzle Baron's Cryptograms.org (just hit the Play button; but don't get too involved!).
You need a source of quotes to encode/decode. You can find over 9000 of them at One-Line Aphorisms (Fortunes) File. Get the raw text file from there, and discard the category codes (the first two characters of each line).
There are many lists of English words on the Internet; some of them are sorted by frequency. The 6,000 most frequently used English words is interesting primarily because it's easy to copy and paste the words into a text file (you might not want to use all 6000; or, you might want to use just the first 1000, plus some other list that isn't sorted by frequency). Or perhaps you can find better lists.
There are lists of letter frequencies, bigram and trigram frequencies, and a few similar things, at this page at Puzzle Baron's Cryptograms.
The latest release appears to be scalatest_2.10-2.0.RC1.jar. If you are using a scalatest_2.10-1.9something jar, you should replace it--the newer version is really much more convenient to use. (I've been using M8 rather than RC1; so far I haven't seen any differences.) In Eclipse you can go to Project → Properties → Java Build Path → Libraries where you can use the Remove and Add External Jars buttons to replace the version of Scalatest that you are using.
Use TDD (Test-Driven Development). Every method* you write should be unit tested!
I'd like to place as few restrictions as possible on you for this assignment, but I'd also like to be able to run my own unit tests. So I'll ask you to name your project
Cryptograms, use a package
cryptograms, and in the package have an object
Dave containing the following methods:
def encode(plainText: String, code: String): String
plainTextmessage and returns the coded message. Encoding means replacing each
'A'in the message with the first letter in the
'B'with the second letter in the
code, etc. The
codeshould be exactly 26 letters long. No letter should be encoded as itself. Before doing anything else, all lowercase letters in the arguments should be replaced by the corresponding uppercase letters. Non-letters should be unchanged.
def decode(encodedText: String, code: String): String
encode: The 26-letter
codeString is used in the "opposite direction." What is encoded with a given
codecan be decoded with the same
code. Also, the
decodemethod can assume neither the
codecontains any lowercase letters.
def discoverCode(message: String): String
Dave object may contain helper methods used only within this object, but it should not contain any methods needed by the rest of the program. The entire purpose of
Dave is to give me an "entry" into your code. Your program should not depend in any way on the presence of this object.
Write a separate
DaveTest class to test the methods in
*You may have methods whose sole purpose is to do input and/or output, and such methods need not be tested. However, when running unit tests, no output should be produced nor input expected.
.zipfile, to Canvas by 6am Friday, October 18. Decide which of you is going to turn in the assignment, and make only one submission for the two of you. Make sure both of your names are in comments at the top of each file.