package class1_3_Caesar_start; // Created by Dr. Yoder on 08 Mar 2017. import java.util.Scanner; // José public class CaesarCipher { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Please enter a string to encrypt:"); String line = in.nextLine(); System.out.println("Please enter the offset:"); String keyString = in.nextLine(); int key = new Scanner(keyString).nextInt(); System.out.println("line = " + line); System.out.println("key = " + key); String ciphertext = encrypt(line, key); System.out.println("ciphertext = " + ciphertext); } private static String encrypt(String line, int key) { String ciphertext = ""; for(int i = 0; i < line.length(); i++) { char c = line.charAt(i); ciphertext += c; } return ciphertext; } }