Hi,
I wanted help implementing how to count vowels and preposition in a text file..this is what i have for counting words, the other are blank because i simply can't get it to work..Help is greatly welcomed..
import java.io.*;
public class FileIO {
public static void main(String[] args) throws IOException {
countWords();
countVowels();
countPrepositions();
}
public static void countWords() throws IOException {
FileReader fr = new FileReader(
"G:\\Java 1302\\project\\FILEIO\\src\\input.txt");
BufferedReader br = new BufferedReader(fr);
StreamTokenizer stz = new StreamTokenizer(br);
int index = 0;
int numWords = 0;
while (index != StreamTokenizer.TT_EOF) {
index = stz.nextToken();
numWords++;
}
System.out.println("number of words in file = " + numWords);
}
public static void countVowels() throws IOException {
}
public static void countPrepositions() throws IOException {
System.out.println("number of prepositions in the file =");
}
}