A sentence is constructed from a string containing all the words in a sentence, such as "The earth is flat." or "How are you today?"

You should remove the punctuation mark from the last word.

You can assume that words are separated by a single space, and that there is a punctuation mark at the end of the sentence.

Implement the constructor and the methods getWord and getCount.

Complete the following file:


import java.util.ArrayList; /** This class models a sentence. */ public class Sentence { private ArrayList<String> words; /** Construct a sentence with a given text. @param text the sentence. The text ends in a punctuation mark which is not stored. */ public Sentence(String text) { // your work here } /** Get the ith word in the sentence. @return the ith word */ public String getWord(int i) { // your work here } /** Get the number of words in the sentence. @return the number of words */ public int getCount() { // your work here } // This method is used for checking your work. Do not modify it public static String check(String sent) { Sentence aSentence = new Sentence(sent); return aSentence.getWord(aSentence.getCount() - 1); } }