Results 1 to 2 of 2
Thread: Help with creating ciphertext
- 02-24-2012, 02:46 PM #1Member
- Join Date
- Jan 2012
- Rep Power
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:
plaintext: I LOVE COMPUTER SCIENCE
Ciphertext: D GJQZ XJHKPOZM NXDZIX.
This is what I am at so far:
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();
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
- 02-24-2012, 05:09 PM #2
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?
- By kumalh in forum New To JavaReplies: 9Last Post: 07-29-2011, 02:18 PM
- By funnygames in forum New To JavaReplies: 5Last Post: 09-27-2010, 07:53 PM
- By nitinverma in forum AWT / SwingReplies: 1Last Post: 07-12-2010, 11:07 AM
- By aRTx in forum New To JavaReplies: 2Last Post: 04-19-2010, 06:25 PM
- By Dieter in forum Advanced JavaReplies: 3Last Post: 09-25-2009, 11:45 PM