Following is my code snippet:
for (int i=0;i<(in.length());i++)
{
char e=cop.charAt(i);
if (e==' ')
{
sav=sav+" ";
continue;
}
int n=(int)e;
if (n>=(91-ef))
{
//here is where the statement should be
continue;
}
n=n+ef;
sav=sav+((char)n);
}
in: String entered by the user
ef: encoding factor entered by the user
sav: in which I'm storing my modified String
Here what I need to do is input a string (word or sentence) in upper case and increase the ASCII value of each character of the string by an encoding factor entered by the user and print the respective character at the new ASCII value. Spaces will remain spaces and if the character should exceed 'Z', it'll start again from 'A'. It's the last part I'm having problem with. There should be one statement at the place I've commented in the above code but I can't figure out what it should be. Please help?
Here's an example what I need to do:
INPUT: tommy
OUTPUT: YTRRD (when the encoding factor is 5)