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...
Type: Posts; User: Norm
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...
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) {
...
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?
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...
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...
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...
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:...
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...
I don't see it. Where did you post it?
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...
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.
no problems. Whenever you get to it.
I guess it's gone. You'll have to try again.
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...
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.
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...