dhust
8/1/2013 - 7:02 PM

gistfile1.java


public class Cipher {

    public static void main(String[] args) {
  	// TODO Auto-generated method stub

		String plaintext = "Oh say can you see";
		String ciphertext = "";
		String key = "shift";
		
		//String alphabet = "abcdefghijklmnopqrstuvwxyz";
		
		if (key == "shift") {
			//newAlphabet = "bcdefghijklmnopqrstuvwxyza";
		}
		
		for (int i = 0; plaintext.length() > i; i++) {
			char character = plaintext.charAt(i);
			int ascii = (int) character;
			
			// Shift +1
			int newAscii = ascii+1;
			char newCharacter = (char) newAscii;
			
			// Create ciphertext using the shifted character
			ciphertext += newCharacter;
		}
		
		System.out.println(ciphertext);
		
	}

}