Redo Exercise P13.1 with a recursive helper method that reverses a substring of the message text.

Complete the following files:

Sentence.java

/** A sentence that can be reversed. */ public class Sentence { private String text; /** Creates a Sentence object. @param aText the text of this sentence. */ public Sentence(String aText) { text = aText; } /** Reverses this sentence. */ public void reverse() { reverse(0, text.length() - 1); } /** Helper method to reverse a part of the sentence. @param start the first index to include in the reversal @param end the last index to include in the reversal */ private void reverse(int start, int end) { . . . } /** Gets the sentence text. @return the sentence text */ public String getText() { return text; } }

SentenceTester2.java

Use the following file:

SentenceTester.java

/**
   A tester class for Sentence.
*/
public class SentenceTester
{
   public static void main(String[] args)
   {
      Sentence greeting = new Sentence("Hello!");
      greeting.reverse();
      System.out.println(greeting.getText());
      System.out.println("Expected: !olleH");
   }
}