Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Count the number of vowels, words, and sentences.

 
Ice Brazuca
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic