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: 3737334 • 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.

Border Cases for Lower Case Letters ight before 'a' and right after 'z. The UTF-8 code for UTF-8 code 122 (which The border cases for lower case letters are r to be sure that characters with UTF-8 code 96 will not be counted while characters coded as 97 will be counted. There is a similar border between is z and 123 (which Is (). We'd like a test to be sure those borders behave properly. @Test public void testCountLowerBorder() SentenceCounter borderCounternew SentenceCounter assertEquals (2, borderCounter.countLowerCase()) - new SentenceCounter((char) 96+ "az]") This test is using a string designed to test the border instead of the instance variables scl and sc2. Building that string is a little tricky because the character that immediately precedes 'a' in UTF-8 is "accent grave" which you may not have on your keyboard. Therefore, we are forcing it to create that character by using the UTF-8 code and typecasting it to a character. This would have been even more robust if we had coded it as (char) ('a'-1) This test will probably go GREEN right away, but it's good to be thorough! REFACTOR.

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