I am a begining software engineer in college and have been stumped by a small problem. The assignment is to "encrypt" any text entered. All we have to do is make capitals lower case and vice versa, additionally we have to make a's z's, b's y's and so on.
//import java.util.Scanner;
//import java.util.Formatter;
import java.util.*;
public class Upper {
public static void main(String[] args) throws Exception {
int x;
String s;
char ch;
Formatter output = new Formatter ("CIA.txt");
Scanner input = new Scanner ( System.in );
System.out.println("Enter text ");
while (input.hasNext())
{
s = input.nextLine();
for (x=0; x <= s.length()-1;x++)
{
ch=s.charAt(x);
if ((ch >= 'a') && (ch <= 'z'))
ch=(char)(((int)ch)-((int)'a')+(int)'A');
output.format("%s",ch);
}
output.format("\n");
//System.out.println();
}
output.close();
}
// end of main method
}
// end of the class