CIS 270 Extra Credit Assignment

Points: 10 Due Date: Tuesday October 21, 2003

This will involve several topics we have discussed lately. You will construct a class that represents an encrypted message.

All messages have a string that holds s original message in encrypted form and a key value. There will be a method that takes a key as an argument and returns the decrypted string. It will only return the string if the key matches the stored one. The original message is not stored in the object. There is no method to get the key, nor can it be changed once the object is created (hint: constructors).

The encryption algorithm can be very simple. A substitution cipher is adequate. This is done by replacing every letter by another in the alphabet. For example, using a 1 element substitution(key), the message "zebra" turns into "afcsb". Note that 'a' becomes 'b' and 'z' becomes 'a'. You can do this with a bigger number, so that 'a' becomes 'e', but 1 is enough. ASK if you are not sure what this means. Try it on paper first(hint: write down the alphabet).

You can test this on messages that don't have any punctuation and you can skip spaces.

Deliverables:

You should turn in a listing of the program. Staple the cover sheet to that.

Notes

Think about how you will do this so you can ask questions.
ASK if you have any questions.