Search:

Type: Posts; User: jwr

Search: Search took 0.07 seconds.

  1. Replies
    6
    Views
    1,279

    Re: Analyzing Input Files, Code Runs Forever

    Ahh, I see. So now I just need to make use of
    words.nextToken() somehow... Is there a way I can do this without having the nextToken printed every time?

    --- Update ---

    Ah, nevermind. That was...
  2. Replies
    6
    Views
    1,279

    Re: Analyzing Input Files, Code Runs Forever

    Yes, this loop is running forever:
    while (words.hasMoreTokens()){
    numWords++;
    System.out.println("Word Count: " + numWords);
    }

    I also tried using
    StringTokenizer words = new...
  3. Replies
    6
    Views
    1,279

    Re: Analyzing Input Files, Code Runs Forever

    Ah, good idea. The problem I found is that it doesn't stop counting the number of words, or it is taking too long.
    Is
    StringTokenizer words = new StringTokenizer(line, " "); The write code to use...
  4. Replies
    6
    Views
    1,279

    Analyzing Input Files, Code Runs Forever

    So, my assignment is to write a program that takes a file as an input and give some statistics on the file. Right now, I'm just trying to find the average number of words per sentence.

    I extended...
Results 1 to 4 of 4