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
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?