Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

the letters of the alphabet are mapped to: a = 0 b = 1; c = 2; d = 3; . . z =25

ID: 3619366 • Letter: T

Question

the letters of the alphabet are mapped to:
a = 0
b = 1;
c = 2;
d = 3;
.
.
z =25

By adding each character in String "one" and String "two" (one+two), you get a new letter.
But , if the sum of characters is greater than 'z'(25) , then youmust do (sum of characters%26)
How do I get character (not integers) from the code below?

The output is 20 , 21 , 5 , 13 , 18 , 19 , 19 , 14 , 7 ,5. Since: 20 is 'u'           21 is'v' ,           5is "f"            18is 's'            19 is 't' ,            19 is 't' ,           14 is 'o' ,           7 is 'h' ,             5 is 'f'
I want the output to be uvfnsttohf.  uvfnsttohf is the output "mapped" aschar.


public class Hs
{
    public static void main(String []args)
    {
        String;
        String two ="bobbobbobb";

        for(int i = 0;i<one.length();i++)
        {
           if(one.charAt(i)-97 + two.charAt(i)-97 > 26)
            {
               System.out.println((one.charAt(i)-97 +two.charAt(i)-97) % 26);
            }
            else
            {
               System.out.println((one.charAt(i)-97 +two.charAt(i)-97));
            }
        }
    }
}
the letters of the alphabet are mapped to:
a = 0
b = 1;
c = 2;
d = 3;
.
.
z =25

By adding each character in String "one" and String "two" (one+two), you get a new letter.
But , if the sum of characters is greater than 'z'(25) , then youmust do (sum of characters%26)
How do I get character (not integers) from the code below?

The output is 20 , 21 , 5 , 13 , 18 , 19 , 19 , 14 , 7 ,5. Since: 20 is 'u'           21 is'v' ,           5is "f"            18is 's'            19 is 't' ,            19 is 't' ,           14 is 'o' ,           7 is 'h' ,             5 is 'f'
I want the output to be uvfnsttohf.  uvfnsttohf is the output "mapped" aschar.


public class Hs
{
    public static void main(String []args)
    {
        String;
        String two ="bobbobbobb";

        for(int i = 0;i<one.length();i++)
        {
           if(one.charAt(i)-97 + two.charAt(i)-97 > 26)
            {
               System.out.println((one.charAt(i)-97 +two.charAt(i)-97) % 26);
            }
            else
            {
               System.out.println((one.charAt(i)-97 +two.charAt(i)-97));
            }
        }
    }
}
           18is 's'            19 is 't' ,            19 is 't' ,           14 is 'o' ,           7 is 'h' ,             5 is 'f'
I want the output to be uvfnsttohf.  uvfnsttohf is the output "mapped" aschar.

Explanation / Answer

       

        String;
             String two = "bobbobbobb";

             for(int i = 0; i<one.length();i++)
             {
                  int resultChar;
                 if(one.charAt(i)-97 + two.charAt(i)-97 > 26)
                 {
                    resultChar = ((one.charAt(i)-97 + two.charAt(i)-97) % 26);
                                                                            
                     
                 }
                 else
                 {
                     resultChar =(one.charAt(i)-97 + two.charAt(i)-97);
                    
                 }
                 System.out.print((char)(resultChar + 97));
             }