Results 1 to 2 of 2
  1. #1
    bdl1127 is offline Member
    Join Date
    Jan 2012
    Posts
    26
    Rep Power
    0

    Default Help with creating ciphertext

    I need to create a program that will convert a string to cipher text. The user input interval shift is supposed to ask the user how many characters they want to shift over. the program is then supposed to take a string that a user inputs and convert it to ciphertext.

    for example if the user inputs 1 for shift:

    string alpha would cipher into: ZABCDEFGHIJKLMNOPQRSTUVWXY.

    The program also has to be able to cipher a user input string:

    ie.

    plaintext: I LOVE COMPUTER SCIENCE

    ciphers into

    Ciphertext: D GJQZ XJHKPOZM NXDZIX.

    This is what I am at so far:

    int shift;
    Scanner in = new Scanner (System.in);
    System.out.println("Enter the number of letters to shift to the right: ");
    shift = in.nextInt();
    Scanner sc = new Scanner(System.in);
    System.out.println("Please enter a sentence to convert to ciphertext: ");
    String str = sc.nextLine();
    System.out.println(str.toUpperCase());
    String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";


    I know i need to create a for loop i just down know what the parameters will be or if i need nested for loops, etc.

    any help is appreciated! TIA

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,327
    Rep Power
    25

    Default Re: Help with creating ciphertext

    Work on the project one step at a time. For example:
    Given the number of letters to shift and a single character from the String to be shifted,
    how do you shift that character?

    When you got the code for that, then worry about looping.

    Have you worked through all the steps your program needs to take for the whole program?
    Can you make a list of the steps it needs to do?

Similar Threads

  1. Replies: 9
    Last Post: 07-29-2011, 02:18 PM
  2. Creating an EXE help
    By funnygames in forum New To Java
    Replies: 5
    Last Post: 09-27-2010, 07:53 PM
  3. Creating jar
    By nitinverma in forum AWT / Swing
    Replies: 1
    Last Post: 07-12-2010, 11:07 AM
  4. Replies: 2
    Last Post: 04-19-2010, 06:25 PM
  5. Creating files stopped creating...
    By Dieter in forum Advanced Java
    Replies: 3
    Last Post: 09-25-2009, 11:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •