Ask if they want to encrypt a message.
ToLower:
Input: a string
Output: A string where all alphabetic characters are in lower case
for each letter in the string
convert that letter to lower case.
GetShiftAmount
Input: no input from main
Output: returns an integer between 0 and 26 to main
Assumes no errors on input.
Prompt for number
Read in number
Convert the number to the proper range.
Return the number
Convert a number to the proper range.
Input: an integer
Output: an integer between 0 and 25
While the number is less than 0
add 26 to the number.
return the number % 26
GetPlainText
Input: none
Output: A string
Prompt the user for the message
Read in the next line
Return this line
Encode
Input: a string, the message
an int, the shift amount
Output:
The encrypted message;
for each letter in the string
encrypt that letter
return the encrypted string.
Encrypt Letter
Input: a character and a shift amount.
Output: the encrypted character.
If the letter is alphabetic
Note if the letter is upper case
Convert the letter to lower case
Shift the letter by the shift amount.
if the original was upper case
convert the shifted letter to upper case
else
shifted letter = original letter
return the shifted letter
Shift a letter
Input: a lower case character
a shift amount
Output: a shifted letter
find the position by subtracting 'a'
new position = position + shift amount
convert the new position to the range 0-25
return 'a'+new position