Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Encode and decode - Caesar cipher

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Thanked 0 Times in 0 Posts

    Default Encode and decode - Caesar cipher

    Hi all,

    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?

  2. #2

    Default 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).
    Kenneth Walter
    Software Developer

Similar Threads

  1. Cipher Program
    By Shyamz1 in forum Object Oriented Programming
    Replies: 2
    Last Post: September 20th, 2011, 04:11 PM
  2. SQL Max Decode Problem
    By Jack_Maloney in forum Java Theory & Questions
    Replies: 1
    Last Post: July 21st, 2011, 07:13 PM
  3. Replies: 0
    Last Post: June 19th, 2011, 02:16 AM
  4. [SOLVED] How to decode ENCODING=QUOTED-PRINTABLE encoded data?
    By efluvio in forum Algorithms & Recursion
    Replies: 8
    Last Post: June 13th, 2011, 04:10 PM
  5. Decode Binary Packet via TCP Socket
    By maxice in forum Java Networking
    Replies: 0
    Last Post: November 8th, 2010, 03:38 PM