This problem is asking for me to write a method in the SentenceCounter class tha
ID: 3737343 • Letter: T
Question
This problem is asking for me to write a method in the SentenceCounter class that will pass the test in the images above.
String Containment re ready to do more general eneral matching contains a given We've been looking for blanks in our string, but now we're ready to algorithms. To start, let's build a method that tells us whether the s character. Here's the test: e it compile and the String API tells ontains () method ce coding how that do NOT use tha write enough code to make it com watch it go RED. Test public void testContains (0 While you know that the Strine that string provides a contains assert True (scl. contains ('T')); assertTrue (scl. contains ('y')); it's important to practice coding assertFalse (scl. contains ('z')); method works. Therefore, do NOT assertFalse (Scl. contains ('Y')); method to make your test GREEN, Inste for this method, we need a loop that wall through the string. As soon as we see the character we're looking for (inside the loop), we can return true. If we finish tha character we're looking for isn't there, so we should return false. Write the code to get and then REFACTOR.Explanation / Answer
public class SentenceCounter { private String sentence; public SentenceCounter(String sentence) { this.sentence = sentence; } public String getSentence() { return sentence; } public int countBlanks() { int count = 0; for(int i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.