Description of
the project
CPE 353-01 Software Design and
Engineering, Fall 2009
University of Alabama in
Huntsville
Project #1 (10 points) – Caesar
Cipher Dialog v1.0
1. Assignment Due Date 09/18/2009 by
Noon
2. Assignment Description
Manually code a Qt4 dialog that will allow
one to encrypt or decrypt a word using a
Caesar Cipher. With a Caesar Cipher, an integer key value is used
to specify the amount of shift between the plaintext and
ciphertext alphabets. For example, assume that the key value is
2.
To encrypt a plaintext word, substitute
each plaintext letter from the word with the corresponding letter
from the ciphertext alphabet. In this case, "hello" would become
"jgnnq". Decryption works in the opposite direction – from
ciphertext alphabet back to plaintext alphabet.
The dialog should display one
QSpinBox and two QLineEdit widgets (with matching
labels). The spin box specifies an integer value that indicates
the desired alphabet shift (encryption/decryption key) for the
Caesar Cipher. One line edit will be used to input or display the
plaintext (unencrypted) word, and the second line edit will be
used to input or display the ciphertext (encrypted) word. All
line edits should be limited to lower case letters only, and the
maximum number of input characters is 26.
Three QPushButtons will be needed on this
dialog. The Quit button to allows the user to terminate
the program, and the Clear button allows the user to erase
all text content in the plaintext and ciphertext line edits . The
third button changes between encryption and decryption modes. In
addition to changing the operating mode, pressing of the third
button updates the key label and third button text (see
examples on following page) to reflect the current
mode.
When in encryption mode, one may only type
in the plaintext line edit – the ciphertext line edit
should not allow typing. Instead, as one types in the
plaintext edit, the encrypted characters appear in the ciphertext
edit. When in decryption mode, one may only type in the
ciphertext line edit – the plaintext line edit should
not allow typing. As characters are entered into the
ciphertext line edit, the equivalent decrypted characters appear
in the plaintext line edit. A change in the spin box value should
trigger updates in the appropriate plain/cipher text line
edits.
Hint: The text in a line
edit is stored as a QString. As with C++ strings the [ ] operator
may be used to index into a QString value to retrieve a QChar.
The QChar method unicode() may be used to retrieve the unicode
integer representation of the character.
You can use this integer representation to
help you compute the equivalent ciphertext/plaintext character.
Don't forget to wrap when needed.
3. Upload all project files (*.cpp,
*.pro, .h, etc.) to the Angel Dropbox for
Project1.
You may develop your product on any
platform you choose (Linux, Mac OS X,
Windows), but
it will be graded on the Linux machine
blackhawk.eng.uah.edu so be sure to verify
operation on blackhawk prior to
submission.
4. Assignment Constraints
Widget Restrictions:
You may only use widgets we have seen thus
far (Chapters 1-3 or in lecture note examples) or your own
widgets that you have derived from them.
Examples: QDialog, QLabel, QLineEdit,
QPushButton, QHBoxLayout, QVBoxLayout, QGridLayout, QSpinBox,
etc.
Development Tool
Restrictions:
You must manually code all classes,
including the GUI code, on this assignment. Youare allowed to use
qmake to automatically generate project and
makefiles.
Miscellaneous
Constraints:
• You must manually-generate
all code for this assignment ? no Qt
Designer
You will receive zero credit (0) for
using Qt Designer on this assignment.
• No memory leaks
allowed
• Your program must be cross-platform
compatible (Linux, Windows, or Mac OS X).
You have access to the
Linux system blackhawk.eng.uah.edu for development
and testing.
Solution
This program has been created with this
version of Qt:
Open the program, click on File,
New…, select an Empty Qt4 Project:
Página siguiente |