I have been struggling this past week trying to write a class that will allow a user to enter a line of text that is suppose to be less than 20 characters long. If this string is greater than 20 characters long then it is suppose to throw it out and ask the user to re-enter the message. I have been ablet to write the array to store the line of text and have been able to retreive whatever character I need to. I can not figure out how to create a statement that is looking for less than 20 characters that has to deal with characters. Any help, suggestions, or CODE preferable would be greatly appreciated. Thanks in advance!
Have you looked at documentation about arrays and the String API?
We're not going to write your homework code for you.
posted 14 years ago
I have read quite a lot including many post in here and on Sun forums. I am not wanting my homework code written for me either. Actually I figured out my biggest problem. I did not need to be using a Array but rather a string. I have finally got everything working besides asking the user to repeat the task because he has entered to many characters. There is a lot of good information in these forums and I did not mean to imply I wanted anyone to do my homework for me I just reached an impass I was trying to get pointed in the right direction. Thanks for the kick in the butt!
Hi, You shuould try to read String API. If those user's entry is a string, you can get the length of that. After that you can add the condition whether the lenght of that string less than 20 character or not..
I think that is a point of your problem.. Hope this helps you... Correct me if I am wrong.