*
The moose likes Java in General and the fly likes Count the number of vowels, words, and sentences. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Count the number of vowels, words, and sentences." Watch "Count the number of vowels, words, and sentences." New topic
Author

Count the number of vowels, words, and sentences.

Ice Brazuca
Greenhorn

Joined: Nov 08, 2009
Posts: 4
Hey guys I am trying to make a program called word that uses the a text file called output in order to:
1) Count the number of words.
2) Count the number of vowels (a,e,i,o,u *disregard y*)
3) Count the number of sentences.
4) Count the number of lines.
5) Count the number of punctuations.
6) Count the number of characters.

For my output text I have:


Now I tried doing this program in two different ways and I haven't been able to make any of them work so I will show you guys both ways I've done it.

***Here is my first attempt at the program.***





The errors I am getting with this one are:
a) Each "answer" is repeated like 3 times for some reason.
b) It won't read how many sentences I have in the output file.
c) It won't read how many punctuations I have in the output file.


***Here is my second attempt at the program.***



The error I am getting with this one are:
a) It erases the output text file and then give me the message "File is empty. Aborting Program"




Can anyone help me? I've been trying to get this program working for over three days...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Count the number of vowels, words, and sentences.
 
Similar Threads
counting specific words from a text file
Passing Vector elements to an array
String Array
ArrayList Problem
Loop Problem