CSCE 2004 - Programming Assignment 5
Due: Wednesday, April 6, 2011 at 11:59pm
1. Problem Statement:
The purpose of this assignment is to become familiar with strings, operations on strings, and
simple cryptography. In this assignment, you will implement a simple substitution
encryption algorithm called Caesar
The basic concept of the Caesar Cipher is to take a message (called the
plaintext) and shift each letter to the right a predetermined value (called the
key). The resulting scrambled message is referred to as the ciphertext.
Afterward, we should be able to use the ciphertext and key to reconstruct the plaintext when
Example: Take the word EXAMPLE and encrypt it using the key C. Since C is the
third letter in the alphabet, the "offset" is 3, meaning each letter in the plaintext will
be shifted three places to the right, becoming a new letter in the ciphertext. So, after
applying the offset to each letter in EXAMPLE we get the following:
This assignment will consist of 4 steps:
Important: Each of the following steps should appear together in your HW5
submission. We recommend creating a "main menu" loop to allow each of the following options
to be selected and run in your final program. This implies that there will be a pair of
encryption() and decryption() functions for each part. However, the choice of overall program
structure is up to you. (Choose wisely!)
In order to effectively design this assignment you need to build on knowledge attained
since the beginning of the semester. You may use any design you like (you will be graded on
your choices), but here are some suggested tips to get you started:
Start your program with comments based on your design and (the following cannot be
add portions of code a little at a time. Compile and run your
program on a regular basis, so you always have something that
runs, even if it only does part of the job. Make sure you have
completed the first task, e.g., printing your name to
the screen, before you start writing code for the
4. Testing and Debugging:
Test your program to check that it operates correctly for all of
the requirements listed above. Also check for the error handling capabilities
of the code. For debugging purposes, it is useful to "echo" any variables you
input, and to print intermediate results as they are calculated.
You should comment out your debugging code before you hand in your
final version of the program.
When you have completed your C++ program, write a short report (less than
half of a page long; a few sentences will suffice) describing what the objectives were, what
you did, and the status of the program. Does it work properly for all test cases? Are there
any known problems?
Include this report in the comments at the top of your source code file.
Finally, when you are finished, run your full program from start to
finish. Copy/paste the entire screen output from at least one full run of your program
at the bottom of your source code. Use comments around this output (that is, /* and */)
to ensure your program still compiles as-submitted after this addition.
6. Project Submission:
To Submit Homework 5:
- Begin an email to your TA with the exact title "CSCE 2004 HW5".
- Copy/paste the contents of your source code file into the body of the email.
(Note: Do not add anything extra to the body of the email! And make sure your
FULL name and uark ID number are printed out at the beginning of your program...)
- Send the email!
- If your lab is Monday, Thursday, or Friday, you should be emailing cporter(at)uark.edu
- If your lab is Tuesday or Wednesday, you should be emailing dapon(at)uark.edu
The date/time-stamp on your email will be used to verify that you met the due date above.
All late projects will receive reduced credit (10% off if less than 24 hours late, no credit
if more than 24 hours late), so hand in your best effort on the due date.