[Solved]Java Programming Please Help Thank Sentence Class Determine Phrase Substring Within Sente Q37048899
Java programming. Please help. thank you.
/** The Sentence class will determine if a phrase (substring) iswithin a sentence object,
* for example “ing” is contain in the sentence “The boyis running”*/
public class Sentence
{
/**Instance variable – String that represents asentence. */
private String sentence;
/** Constructor – single parameters that sets theinstance variable
* @return */
public Sentence()
{
}
/** Accessor and mutator for the sentence*/
public String getSentence()
{
return sentence;
}
public void setSentence(String sentence)
{
this.sentence = sentence;
}
/** find method
1. takes in aString parameter that represents the target substring,
(what we arelooking)
2. returns trueif the substring occurs in the sentence, false if it
doesn’toccur.
3. Must userecursion and use this algorithm
1. If sentence starts with the target substringreturn true
2. If not, test the rest of the sentencerecursively.
3. Remember to include stopping base case(s).*/
public boolean findSentence()
{
}
/** Enhancement (Optional)
1. create an indexOf method
1. takes in aString parameter that represents the target substring, (what we arelooking)
2. returns theindex in the Sentence of the first occurence of the targetsubstring
or -1 if notfound
3. Must userecursion
4. One approachis to use a recursive helper method
The purpose of a”helper” recursive methods is, in general, to hide the countingof
something. Theyusually have (at least) one additional parameter that somehowdescribes
how far therecursion has already proceeded or how far it still has toproceed.
In our case thehelper method extra parameter would be where the new stringstarts,
and thatparameter would be returned when the substring isfound. */
}
================================
public class SentenceTester
{
/** 1. Create a SentenceTester class
1. Create a Sentence object.
Test several phrase including several with match throughout thesentence
and some that do not match.*/
}
Expert Answer
Answer to Java programming. Please help. thank you. /** The Sentence class will determine if a phrase (substring) is within a sent… . . .
OR

