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.
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.
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! :(
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
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.