Computer Programming II
Lab Project #1 - REDCOATS
This project is a review project, with the addition of classes and
objects. The project will refresh your
problem-solving and programming skills.
It is required for everyone.
DESIGN:
You are to perform a top-down modular design for this and all following
programming projects. You must follow
the design documentation handout. In
this case the design is simple, so you may include it as comments at the top of
the program.
PROBLEM:
You are to write a program in C++ that takes in as input a string message
and an integer. The program will then
scramble the message by converting each character of the message to its numeric
code, adding the specified integer to this code, and then converting the
resulting number back to a character. To
do this, you must create a class that handles a string and an encoding
integer.
Required Class Variables: should include a string to hold the message,
and an int to hold the value to alter the message by.
Required Member Functions:
Private:
Encrypt - which will take in a single letter and return a result of type
char.
Public:
EncryptAll -
which will manipulate class variables in a loop to encrypt all of them.
GetMessage - which will read in a store the message string in a class
variable. GetCode - which will read in a store the encoding value.
PrintOut - which will print out the current values of the class
variables. To make it more readable,
make sure that you skip spaces in the string (don't change them). For example, on our ASCII machines, the
message:
THE REDCOATS ARE COMING!
and the integer 5 would produce:
YMJ WJIHTFYX FWJ HTRNSL&
DELIVERABLES:
You are to turn in a hardcopy of the source file, including the design as
comments, and a hardcopy of your testing, following our class testing
standards.