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

* This method reverses \'in place\' the elements in * the array. Reversing is de

ID: 3617659 • Letter: #

Question

* This method reverses 'in place' the elements in
     * the array. Reversing is defined asmoving the
     * elements in the array such that thefirst element
     * becomes the last element, the secondelement
     * becomes the second to last element,etc.
     * <p>
     *
     * <p><b>You will write thismethod as part of programming assignment #9.</b>
     *
     * @param symbols   An array thatwill be reversed.
     */
    public static void reverseOrder (Character[]symbols)
    {
       if(symbols.length < 0)
       {
           System.out.println("The array that you entered isempty");
       }
       for(int reverse =(symbols.length - 1); reverse >= 0; reverse--)
        {
          
            Characterc = symbols[reverse];
           System.out.print(symbols[reverse]);
       }
      
    }

This is the tester that is run on that method.

Character [] newlist = newCharacter[]{'a','b','c','f','n','q'};
       System.out.println("");
        System.out.print ("Thearray [");
        separator = "";
        for (Character s :newlist)
        {
           System.out.print(separator + s);
           separator = ", ";
        }
        System.out.print ("]entered ");
      
       ArrayExercises.reverseOrder(newlist);
        System.out.print ("lookslike this in reverse order[");
        separator = "";
        for (Character s :newlist)
        {
           System.out.print(separator + s);
           separator = ", ";
        }
        System.out.print ("]");
      
        System.out.println("");

i need to have it print this
For reverseOrder, the input array {'a', 'b','c'} should be changed to be {'c', 'b','a'}. Note that the type is Character,and not char, but that Java will convert between thesetwo types automatically.


and this is what mine prints
The array [a, b, c, f, n, q] entered qnfcbalooks like this inreverse order[a, b, c, f, n, q]

It prints the result but does not modify the original array, and ican not use the library classes to manipulate or search througharrays. The Arrays class is not allowed.

Explanation / Answer

please rate - thanks your reverse loop should look like this where n is the number of characters in the array (string) for(k=0;k