I've created a program that counts the amt. of characters, words, and lines in a text file...I also need it to count the number of blank lines and the number of vowels in the text document. I don't know why, but I cannot seem to get it to work. If anyone can give me some pointers, I'd very much appreciate it. Thanks much!

Recommended Answers

All 3 Replies

when you read the file, you read it line by line I guess?
What's a special characteristic of a blank line? Hint: it has to do with the number of characters on it after stripping whitespace.

What's a vowel? How can you detect it? When you know that all you need to know is how to loop through your input and count them.

You could have an array of vowels which you could campare with every :( letter and if theres a match increment a vowelCount variable :)

I'm not sure what method you are using to do this program, but a simple way to count the vowels would be to use the String Tokenizer class and set the delimeters to vowels. Use a while structure that checks .hasMoreTokens and loops through until there aren't any left. I recently made a program to do much of the same things, and have some code if you want to see an example. If I have made myself unclear, just drop me a line at TMcClish@gmail.com
Later
-tom

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.