Public class Encpryt {
Public encryption () {
Scanner scan = new scanner (system. in);
System.out.println ("Enter four digits:");
string str = scan . next();
while(str! = "q"){
if (str.length()! =4) {
System.out.println ("The number you entered is not 4 digits, please re-enter");
str = scan . next();
Continue;
}
System.out.println ("encryption number is:");
char[]ns = new char[4];
for(int I = 0; I<4; i++){
ns[I]= str . charat(I);
system . out . println(ns[I]-' 0 '+' a '- 1);
}
System.out.println ("Enter four digits:");
str = scan . next();
}
}
/* * * * @ param args
*/
Public static void main(String[] args) {
new Encpryt();
}
}