Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This problem is asking for me to write a method in the SentenceCounter class that will pass the test in the images above. Off the
This problem is asking for me to write a method in the SentenceCounter class that will pass the test in the images above.
Off the End of the String Again This blankPosition () method is Test void testBlankPositionTooFar () walking through a string, so, again, we need to think about assertEquals(1, sci.blankPosition( what would happen if it walked off the end of the string. Let's write a test so that we can see what is happening now: In this test, sc1 doesn't contain four blanks, so we need our method to signal that it didny find what we were looking for. As before, we'll make it return -1 as that signal. Run the te if you didn't think about this as you wrote the code, it will be RED. (If it isn't red, you didnt write the simplest code that would make our previous test pass!). The changes you need to make are very similar to the ones you made in firstBlank (). Get to GREEN and REFACTOR as appropriateStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started