how many of each lower case vowel is in string

I know this is a question that has been asked quite a bit but has not been answered the way I need my code to be. It can use the while, for, and if loops. All I need for the rest of my code ist to count the vowels. I can the code to print which vowels are in the string but not how many of each vowel. Here is what I have.

import java.util.*;

public class Vowel

{

public static void main(String[] args)

{

String str;

char c;

int count = 0;

Scanner scan = new Scanner(System.in);

System.out.println ("Enter a word: ");

str = scan.nextLine();

for (int i = 0 ; i < str.length () ; i++)

{

c = str.charAt(i);

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

System.out.println (c);

}

}

}

[837 byte] By [Vanzena] at [2007-11-27 11:21:02]
# 1

So, do you want someone to write the program for you , or is there a question that we can answer?

ChuckBinga at 2007-7-29 14:46:12 > top of Java-index,Java Essentials,New To Java...
# 2

i'm stuck as what I need to do next. ust some help in the right direction

Vanzena at 2007-7-29 14:46:12 > top of Java-index,Java Essentials,New To Java...
# 3

Inside the for loop you are identifying letters. It would be useful to count them, also.

ChuckBinga at 2007-7-29 14:46:12 > top of Java-index,Java Essentials,New To Java...
# 4

yea i know but how do i go about it cause I tried but with out luck. I cant use the count method either, not allowed to.

Vanzena at 2007-7-29 14:46:12 > top of Java-index,Java Essentials,New To Java...
# 5

well show us what you've tried. that's a good place to start. But remember, if you want to make your code readable so that someone smart will read it and comment on it, please surround your code with code tags when posting. You can find out about them here:

http://forum.java.sun.com/help.jspa?sec=formatting

petes1234a at 2007-7-29 14:46:12 > top of Java-index,Java Essentials,New To Java...
# 6

> yea i know but how do i go about it cause I tried but

> with out luck.

So you know how to increment a variable in your for loop statement but don't know how to do it anywhere else? :confused:

> I cant use the count method either,

> not allowed to.

Excuse my ignorance but what is the count method?

floundera at 2007-7-29 14:46:12 > top of Java-index,Java Essentials,New To Java...
# 7

> Excuse my ignorance but what is the count method?

It's something that he's not allowed to do. :-)

petes1234a at 2007-7-29 14:46:12 > top of Java-index,Java Essentials,New To Java...
# 8

> > yea i know but how do i go about it cause I tried

> but

> > with out luck.

>

> So you know how to increment a variable in your for

> loop statement but don't know how to do it anywhere

> else? :confused:

Well, you see, I know how to count blocks ...

... but I do not know how to count oranges!

--Grover

jverda at 2007-7-29 14:46:12 > top of Java-index,Java Essentials,New To Java...
# 9

Well, you see, I know how to count blocks ...

... but I do not know how to count oranges!

--Grover

Priceless!

ChuckBinga at 2007-7-29 14:46:12 > top of Java-index,Java Essentials,New To Java...