The ROT 13 cypher is a simple method to hide a message so the casual observer ca
ID: 3619961 • Letter: T
Question
The ROT 13 cypher is a simple method to hide a message so the casual observer cannot reader. It works by replacing each letter with one that is 13 spots later in the alphabet, so that a becomes n, b becomes o, and z becomes m, because we wrap around.For this first homework you will implement a program that first asks the user for a number, then for a string, and then prints out the given string but rotated by the number of spots the user requested. You can assume that the string the user types is composed only of lower case letters [a-z]. Here are a couple of sample interactions with the program:
What offset do you want?1
Enter word to translate:abczyx
bcdazy
-----------
What offset do you want?13
Enter word to translate:hello
uryyb
You will implement this homework using typecasting and without using any if-then statements, we have not covered those anyway. You will need to use a for-loop.
It might at first seem that you need to know the values in the basic-latin unicode block, but you don't. All you need to know is that all the lower case letters appear consecutively and in alphabetical order in the table. Also note that if you need to know the unicode number of any character, say 'a', you can simply write a simple program with theh line System.out.println((int)'a'); If you are interested, the wikipedia unicode page tells more than anyone wants to know about Unicode.
Explanation / Answer
please rate - thanks for the life of me, I don't see how this can be done without an if then, without an if else yes, but not without an if thenRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.