answersLogoWhite

0

/*Input: Enter the String: AHFJFJ

* Enter the gap : 2

*Output: CJHLHL

*/

import java.io.*;

class Crypt

{

protected static void main()throws IOException

{

BufferedReader in=new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter the String: ");

String s=in.readLine(),s1="";

System.out.print("Enter the Gap: ");

short g=Short.parseShort(in.readLine());

for(short i=0;i<s.length();i++)

{

char ch=s.charAt(i);

if(Character.isUpperCase(ch))

{

ch+=g;

if(ch>'Z')

ch-=26;

else if(ch<'A')

ch+=26;

s1+=ch;

}

else if(Character.isLowerCase(ch))

{

ch+=g;

if(ch<'a')

ch+=26;

else if(ch>'z')

ch-=26;

s1+=ch;

}

else if(Character.isDigit(ch))

{

ch+=g;

if(j>'9')

j-=10;

else if(j<'0')

j+=10;

s1+=ch;

}

else

s1+=ch;

}

System.out.print("String: "+s1);

}}

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Can we add website link when we write java program?

yes ,i can add the website link in java program when we write.


Write a c program Fibonacci series using for loop in java?

Exactly what do you mean by 'C program in Java'


What is javadoc?

write a java program to display "Welcome Java" and list its execution steps.


How write new line program in java?

\n


How do you write a java program for finding multiligual languages?

You can use Java's built-in functions to write a code that will find multilingual languages.


How java is 100 percent Internet based?

It isn't. It can also be used to write desktop applications. Java does have many options to program for the Internet, but that is not the only possibility.It isn't. It can also be used to write desktop applications. Java does have many options to program for the Internet, but that is not the only possibility.It isn't. It can also be used to write desktop applications. Java does have many options to program for the Internet, but that is not the only possibility.It isn't. It can also be used to write desktop applications. Java does have many options to program for the Internet, but that is not the only possibility.


Write a java code to draw a circle inside in an ellipse?

write a program draw circle and ellipse by using oval methods in java


How do you write a java program to find the ad joint of a matrix?

bgfygfrhjyuyhh


How do you write algorithms of java programs?

Write a program that graphically demonstrates the shortest path algorithm


How does crytography work?

no


How To write a java program to create three tier applications using servlets?

barsanabegam


How do you write a java program to find the square root of a number?

You can use the Math.sqrt() method.