
write a java code given string="bob" as alphabets are 26 Assign A or a as 1,B or b as 2,........Z or z as 26 now "bob" means 2+15+2=19 as b=2,o=15 Now how can i assign values for any given string and get calculated to get accurate result now for given any different string also how can i calculate it through java code as i can do it manually one more example now for given string="abcd" "abcd"=1+2+3+4=10 how can i write the code in core java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class LinearSearchString {
public static void main(String[] args)throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter any String : ");
String tex = br.readLine();
int count=0;
String ss=" abcdefghijklmnopqrstuvwxyz";
for(int k=1;k<ss.length();k++)
{
char number=ss.charAt(k);
System.out.print(k+"="+number+",");
}
System.out.println("\nEXECUTED");
//write the code to add for any word such as
//"bob" means 2+15+2=19
//How can i write please help me
System.out.println("\nEXECUTED");
}
}
output:
Enter any String :
rajkumar
1=a,2=b,3=c,4=d,5=e,6=f,7=g,8=h,9=i,10=j,11=k,12=l,13=m,14=n,15=o,16=p,17=q,18=r,19=s,20=t,21=u,22=v,23=w,24=x,25=y,26=z,
EXECUTED
//print here as 2+15+2=19
EXECUTED
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.