Encode and decode - Caesar cipher
I'm new in Java and I wonder if anyone could give me an idea - How I can write a very simple program that asks for a string of letters as its input, and encodes them with a Caesar cipher that ‘adds one’ to each letter; so ‘a’ gets encoded as ‘B’, and ‘b’ gets
encoded as ‘C’, and so on....maintaining here the convention that lower case is used for plaintext and upper case is used for ciphertext. However I like the program deals entirely with lower case.
Ideally it would:
1. allow you to choose how much (from 0 to 25) to ‘add’ to each letter;
2. deal appropriately with both upper and lower case, and also with spaces and punctuation
(either by preserving the spaces and punctuation or by removing them entirely).
Can anyone give me an idea how to achieve this program?
Re: Encode and decode - Caesar cipher
Obtain the string you want to encode and read the string character by character. Add x (where 0<x<25) to each character (chars can be added with integers).