0

I have an exam coming up on this unit found in the guide to programming with Java textbook. I was just wondering if someone can provide an algorithm to the following question.

13. a.) Write an algorithm to count the number of words in a sentence.
b.) Write an algorithm to count the number of letters in a
sentence.

Please if you can just stick to loop and string methods. We have yet to cover topics such as Arrays. I have been working hard at this and would appreciate any help. Thank you in advance.

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by javaAddict
0

Read the rules pertaining to "we only give homework help to those who show effort", then come back and post something that shows effort. And no, it does not matter whether this is homework or not. Everything posted here falls under that rule.

0

I was just wondering if someone can provide an algorithm to the following question.

Yes, I am quite sure someone can. Unfortunately for you, though, that's your job in this case.

0

Assuming that the sentence is stored in a String variable, why don't you check the String API. We might find something there that could be useful.


PS. I didn't notice that this is my 1666 post!

Edited by javaAddict: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.