Question: please write it in java Part C: String & Array Processing Write a single class called Alternating, which contains four static methods. Your main method

Part C: String \& Array Processing Write a single class called Alternating, which contains four static methods. Your main method will do some testing (described below). The three other methods all accept a String s as their only parameter. They all accomplish the same task, but do so using different algorithms. The task is to return a String with all the characters from s, but in a different order. The first half of the result string contains the characters from all the even positions in s(0,2, 4 , etc.), and the second half of the result string contains the characters from all the odd positions in s (1,3,5, etc.). So if any of these three methods is called with "abcde" then it returns: "acebd" The three different algorithms are as follows: - The evenOdd1() method uses two 'for' loops. The first loop counts by 2 through all the even index positions in s, using s.charAt(i) to append each even character to the result string. The second loop then also counts by 2 , but this time through all the odd index positions, using s.charAt(i) to append each odd character to the result string. - The evenOdd2() method creates two partial String results called evenChars and oddChars. Use only a single 'for' loop that counts by 1 through all the index positions in s. For each index value, use the 'mod' operator (\%) to test whether the index value is even or odd. If even, append s.charAt(i) to evenChars, otherwise to oddChars. At the end, concatenate evenChars with oddChars to create the final result. - The evenOdd3() method also creates evenChars and oddChars, and then concatenates them at the end. Again, use only a single 'for' loop that counts by 1 through all the index positions in s. For each index value, use a boolean variable called isEven to test whether s.charAt(i) should be appended to evenChars or oddChars. Use the 'not' operator (I) to make sure isEven alternates between true and false each time through the loop. Your main method creates an array of test strings exactly as follows: String[]testString={"abababab","eieio","splitmeUpBaby"}; Then loop through that array, calling all three methods with each test string and producing output as shown on the following page: Your main method is to produce the following output: NOTE: Use the equals() method from the String class to com back from the three methods. (How many questions do you whether all 3 results are the same?)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
