sinhashubham99
| Subject: Help plzz..!! Tue Feb 03, 2009 10:54 pm | |
| hey guys can u please tell me how to do dis program...
WAJP to perform the coding process. ex: if string =ABC and no entered is 2 thn output=CDE
if string =XYZ no entered is 2 thn output=ZAB |
|
Anu..i luv icse...:) Active member
| Subject: Re: Help plzz..!! Tue Feb 03, 2009 11:57 pm | |
| it can be done using ASCII |
|
jOhNy Active member
| Subject: Re: Help plzz..!! Wed Feb 04, 2009 2:23 pm | |
| yup...take each charcter of string(using CharAt)and increase the ASCII value by the entered no. keep adding each char in a new string and print it. |
|
akshay Active member
| Subject: Re: Help plzz..!! Wed Feb 18, 2009 6:53 am | |
| hey anu, why should we use ascii? is this enough to receive the same output or have i misunderstood the question: import java.io.*; class cde { public static void main()throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter 1 string and a number"); String s1=in.readLine(); int n=Integer.parseInt(in.readLine()); if(s1.equals("ABC") && n==2 ) System.out.println("CDE"); else if(s1.equals("XYZ") && n==2) System.out.println("ZAB"); }} please check and reply soon!thanks!=) |
|
sahil.anwer
| Subject: Re: Help plzz..!! Wed Feb 18, 2009 8:24 am | |
| This is a program of cryptography. Pick each character using charAt and get their ascii. then add the value of n to the ascii of the character. then match the condition if(char>'z'){char='a');} You will get the output. Reply soon. |
|
Anu..i luv icse...:) Active member
| Subject: Re: Help plzz..!! Wed Feb 18, 2009 11:43 pm | |
| as_24 if we do acc. to ur logic, only the two cases i.e. ABC n XYZ are solved, but i thought, in the question those two are given as examples, we have to design a code suitable for all letters-thts what i thought. so, acc. to me, my logic is similar to sahil's lets ask others how they interpret it!! so, others....reply soooooooon |
|
akshay Active member
| Subject: Re: Help plzz..!! Thu Feb 19, 2009 2:57 am | |
| oh sorry, i didn't know that was the example my mistake. thanks for rectifying it.=) |
|
Anu..i luv icse...:) Active member
| Subject: Re: Help plzz..!! Thu Feb 19, 2009 11:48 pm | |
| its alright!!! |
|
Sponsored content
| Subject: Re: Help plzz..!! | |
|
|
|