You will be implementing a simple word encryption system similar to the Rot13 problem from the Practice With
Strings lesson. Write a method called miniEncryption that takes in 2 arguments: a String representing a word,
and an Int representing a rotation amount. The String word will be non-null and will contain uppercase letters
only. Your method must return the rotated form of this word. The rotation number will be positive (or 0). We
will be
using the string "ABCDEFG" for the rotation key. Specifically, your method must check each character of the
original string, identify the correct replacement (using the rotation key, find the character that is n characters
right (where n is the passed-in Int for the rotation)), and then
return the newly-rotated
string.
For example, miniEncryption("ABC", 1) returns "BCD", because according to our key ("ABCDEFG"), the first
character should change from "A" to "B" (1 char to the right of "A"), the second character should change from "B"
to "C" (1 char to the right of "B"), etc. Be sure to handle the "overflow" case by wrapping back to the
beginning of the key. For example, miniEncryption("FG", 3) should return "BC", because there is only one
character (not 3) after F in our key, so the rest of the two characters must start from the beginning of the string
('F'->'G'->'A'->'B').
Important: The passed-in word argument may contain letters that are NOT part of "ABCDEFG"! In such cases, you should just return the original string (do not encrypt the string).
Assumptions: The passed-in string argument will not be null and will contain only uppercase letters. The
passed-in rotation number will always be non-negative (a 0 rotation means that you should return the original word,
not modified). We will always use "ABCDEFG" as the rotation key.
Stuck? You may find these lessons helpful: