Why wont this compile its killing me. (java)
- by Ryan The Leach
import java.util.*;
public class Caesar
{
public static void main(String [] args)
{
final boolean DEBUG = false;
System.out.println("Welcome to the Caesar Cypher");
System.out.println("----------------------------");
Scanner keyboard = new Scanner (System.in);
System.out.print("Enter a String : ");
String plainText = keyboard.nextLine();
System.out.print("Enter an offset: ");
int offset = keyboard.nextInt();
String cipherText = "";
for(int i=0;i<plainText.length();i++)
{
int chVal = plainText.charAt(i);
if (DEBUG) {int debugchVal = chVal;}
chVal +=offset;
if (DEBUG) {System.out.print(chVal + "\t");}
while (chVal <32 || chVal > 127)
{
if (chVal < 32) chVal += 96;
if (chVal > 127) chVal -= 96;
if(DEBUG) {System.out.print(chVal+" ");}
}
if (DEBUG) {System.out.println();}
char c = (char) chVal;
cipherText = cipherText + c;
if (DEBUG) {System.out.println(i + "\t" + debugchVal + "\t" + chVal + "\t" + c + "\t" + cipherText);}
}
System.out.println(cipherText);
}
}