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!

Recommended Answers

All 11 Replies

Like it says at the top of the page...

Also, to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well.

Explain a bit more

Like it says at the top of the page...

I have put all the base work in ie made the applet and text box, buttons etc just can't for the life of me figure how to do the main part of the coing. I think you have to use swing but i have not been taught any of it and none of my tutors reply to my e mails! :(

Explain a bit more

I need to create an applet that once ran has a text box reset and analise button once the analise button is pressed the program should count the amount of same letter words. for instance sam has a dog would produce the output 1,3 because there are 3 three letter word and 1 one letter word. i have made the text box and buttons just need a little guidance with the coding Thanks

Are you not allowed to cross post?

Yes, but you should tell everyone so that no one wastes time answering a question that has already been answered.

Oh right sorry!

It hasn't been answered on the other forum

That's what the link is for, so anyone can see what is going on.

you could get the characters from the string (that you get from the input) and use a loop to get all the characters in the loop you want to see if there is a space. if there is then you would signal that that is one word, then you would count the letters.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.