Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This problem is asking for me to write a method in the SentenceCounter class tha

ID: 3737335 • 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.

he Position of the First Blank to add another method to our SentenceCounter class with the goal of returning the the first blank in our sentence. Here is the test for this new method: position of the first rest pic void testFirstBlankPosition() assertEquals (4, scl.firstBlankPosition ()) assertEquals (5, sc2.firstBlankPosition ()) Look at the definitions of the strings in the objects scl and sc2 to make sure you understand where the 4 and the 5 come from. Then get to RED by making the test compile, but fail. In order to get to GREEN, you are going to need a sentinel-controlled loop. The loop will still walk through each position of the array, but, instead of going to the end of the string, the sentinel val ue should stop the loop and return the value of the position where getChar () finds the first

Explanation / Answer

//SentenceCounter.java public class SentenceCounter { private String s; public SentenceCounter(String s) { this.s = s; } public int countLowerCase(){ int count = 0; for(char ch: s.toCharArray()){ if(ch >='a' && ch
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote