Search:

Type: Posts; User: Norm

Search: Search took 0.11 seconds.

  1. Re: Java for loops to count vowels/consonants usinf the logic of the main

    For testing write a small (~ 10 lines) program that defines a String and uses the replaceAll() method and prints out the results. Then work on the regular expression used by the replaceAll() method...
  2. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Use a separate counter variable for each thing you want to count,



    int cntr1 = 0; // counter for type 1
    int cntr2 = 0; // counter for type 2
    ...
    if(want to count type 1) {
    ...
  3. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Why not have separate counters for each thing you are counting instead of using the same variable for more than one thing you are counting?
  4. Re: Java for loops to count vowels/consonants usinf the logic of the main

    if ( c != 'a' || c !='e' || c != 'i' || c != 'o' || c != 'u')

    With OR (||) tests only one condition needs to be true for the if to be true.
    c = 'e' means c != 'a'
    In other words, that if will...
  5. Re: Java for loops to count vowels/consonants usinf the logic of the main

    What is printed out by the printlns you have added?

    If you get compiler errors, please copy and paste here the full text of the error messages.

    Instead of having a bunch of independent if...
  6. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Try debugging the code by Adding some println statements to the code to print out the values of the variables like the one that holds the current value of the count. The print out will help you see...
  7. Re: Java for loops to count vowels/consonants usinf the logic of the main

    How about helping the OP understand what his code is doing instead of spoonfeeding code with no comments or description of what it does.
    Read this:...
  8. Re: Java for loops to count vowels/consonants usinf the logic of the main

    You should play computer with your program for one of the Strings that is not counted correctly. Take a piece of paper and Manually do what the code is supposed to do step by step to see where the...
  9. Re: Java for loops to count vowels/consonants usinf the logic of the main

    I don't see it. Where did you post it?
  10. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Please post the output from the program and add comments to it describing what is wrong and show what the output should be.

    Your long paragraphs hide that output if it is inside of them.

    To...
  11. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Please Edit your post and wrap your code with
    <YOUR CODE HERE> to get highlighting


    Does your version of the code compile without errors? The posted code has errors.
  12. Re: Java for loops to count vowels/consonants usinf the logic of the main

    no problems. Whenever you get to it.
  13. Re: Java for loops to count vowels/consonants usinf the logic of the main

    I guess it's gone. You'll have to try again.
  14. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Did you miss my last post? Here it is again:
    Post your current code.
    Can you describe in detail in pseudo code how the program should work to solve the problem? Write a list of the steps the...
  15. Re: Java for loops to count vowels/consonants usinf the logic of the main

    Post your current code.
    Can you describe in detail in pseudo how the program should work to solve the problem? Write a list of the steps the program should do.
  16. Re: Java for loops to count vowels/consonants usinf the logic of the main

    One logic problem I see is this:
    if ( c != 'a' || c != 'e' || c != 'i' || c != 'o' || c != 'u' )

    If any one of those conditions is true (OR connected expression) then the whole condition will be...
Results 1 to 16 of 16