Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+6 votes
asked in CSC211_Winter2018 by (1 point)

1 Answer

0 votes

I was trying to give someone else a chance to answer, but here goes.

To write the helper method, the method would have a parameter of type String. Then use a for loop to loop through each index of the String beginning with 0 up to but not including its length. For each index use the charAt method to get the character at that index comparing it to the character you are trying to count. Remember characters are single quotes so something like word.charAt(i) == 'm'. When true, increase a counter whose value is returned after the loop.

answered by (1 point)