Re: How do I fix my program?
And what is your question? Does it compile? Does it misbehave? Are there exceptions? Please see the link in my signature entitled getting help
Re: How do I fix my program?
So it appears that you've given us the code your teacher gave to you, and you need to fill in the while loop? You're right, that's where the problem is. At this point, your while loop really doesn't do anything useful at all, does it?
Do you have an idea of what is should accomplish?
You want to find some substrings, so you're going to be moving along the file. You want your while loop to exit when you run out of string to traverse, so you must be deleting stuff from the string after you look at it. You know how long your string is going to be (stringLength).
So, start moving through the string, evaluating things using charAt and comparing them with your string, then deleting stuff you've already looked at.
Re: How do I fix my program?
thanks for the replies.
it does compile however it does not do much if anything like you said.
Quote:
So, start moving through the string, evaluating things using charAt and comparing them with your string, then deleting stuff you've already looked at.
yeah that's pretty much the goal of this program. I just have to count the number of instances that the particular substring occurred. but I'm having trouble constructing the proper loop to do the job. I'm thinking a while loop would be adequate..
1 Attachment(s)
Re: How do I fix my program?
Attachment 845
So implement the while loop and come back to us if you have a specific problem with it...