Search:

Type: Posts; User: jwr

Search: Search took 0.26 seconds.

  1. Replies
    6
    Views
    209

    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
    209

    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
    209

    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
    209

    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...
  5. Replies
    11
    Views
    339

    Re: Looping through boolean Arrays

    Norm, I love you... I don't know how I didn't notice that about the ; after the if statement. This fixed my whole code, I had it right all along!
    (And yes I closed the program and that error went...
  6. Replies
    11
    Views
    339

    Re: Looping through boolean Arrays

    Okay, I figured out how to do that. This is the message that I received:

    WeakAnTester2.java:27: warning: [empty] empty statement after if
    if (one.charAt(k) == (char)('a'+j));
    ...
  7. Replies
    11
    Views
    339

    Re: Looping through boolean Arrays

    Sorry, I missed that. I don't have any compile errors, and I'm not sure what you mean by warnings. What is an -Xlint compiler option? I'm using DrJava and can't find that option.. I went to help ->...
  8. Replies
    11
    Views
    339

    Re: Looping through boolean Arrays

    Well, they are all False, because the loops apparently aren't working properly. However, I want to initiate them to False before initiating the for loops and setting the elements to True which...
  9. Replies
    11
    Views
    339

    Re: Looping through boolean Arrays

    Right, so I created two 26 element boolean Arrays - firstArray and secondArray. I want each element of the array to correspond to a character, the 0th element to 'a', 1st to 'b', etc. In my for...
  10. Replies
    11
    Views
    339

    Looping through boolean Arrays

    Hey guys, I've been working on this project for a couple days now and I can't get it right. It's due in 5 hours :\

    Okay, so the assignment is to code a "weak" anagram tester - the program should...
Results 1 to 10 of 10