Can anyone please help me! Very stuck on an assignment i need to code a java applet so that it counts the lengths of words for example i am a man would produce the output 2 - one letter words 1 - two letter word and 1 - three letter word.
Thank you!
Printable View
Can anyone please help me! Very stuck on an assignment i need to code a java applet so that it counts the lengths of words for example i am a man would produce the output 2 - one letter words 1 - two letter word and 1 - three letter word.
Thank you!
See the String class for methods to help you.Quote:
it counts the lengths of words
Then consider where you would hold the counts for various word lengths.
Thank you for your help, i have read numerous textbooks about the string class i just can't seem to get my head round this! Is there anything else you can suggest to do? Also i am not allowed to use the swing library. Thank again
What have you tried? How would you do this by hand, or with a piece of paper and a pencil?
I am completely clueless, been reading up on parsing. Just a beginner!
No, I think the String class is the one to use.Quote:
Is there anything else
What methods of the String class look like they would tell you how many characters are in the String?
word count, char count?
Cross posted at counting word lengths java - Java
What does that post mean? Please explain.Quote:
word count, char count?
What does that post mean? Please explain.Quote:
word count, char count?
Am i not allowed to cross post is that bad? i'm not sure, is there anything else you can suggest?
Yes I suggest that you read the API doc for the String classQuote:
is there anything else you can suggest