Modulo is working correctly, but you've overlooked something. The idea behind using modulo is this. When you represent letters as numbers between 0 and 25 inclusive, and add a number to shift the letter, it may go beyond 25. You can apply % 26 to wrap back to the 0 to 25 range. But it ONLY works if the letters are represented by numbers in that range.
Think about this. What if you apply % 26 to the numeric value of any letter when it is represented by 0 to 25? Nothing happens. Unfortunately, letters are represented in the computer by ASCII codes. Consider this: 'a' % 26
= 19, an unprintable control character.
BEFORE applying any modulo operations to the ASCII value of a letter, you have to convert it to the 0 to 25 range first. Once you're done, you have to convert back to ASCII values by reversing the operation. If you don't understand this concept, you should go back and review the class material.
If this answers your question, please accept the answer to remove your question from the unanswered question pool. Let's keep up on forum maintenance. ;-)