im trying to take an inputed file and use a linked list to read it and display the most frequently used word. Anybody know how to do it?
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.*;
public class mostFrequentWord
{
LinkedList<Word> list = new LinkedList<Word>();
public void Read()
throws FileNotFoundException
{
Scanner input = new Scanner(System.in);
FileReader reader = new FileReader("test.txt");
Scanner in = new Scanner(reader);
in.useDelimiter(" [ ^ a - zA - Z ] + ");
while (in.hasNext())
{
String s = in.next().toLowerCase();
System.out.println(s);
}
}
}
import java.util.LinkedList;
public class Word
{
private String toWord;
private int Count;
public void assign(int count, String word)
{
toWord = word;
Count = count;
}
public void isEqual()
{
LinkedList<Word> list = new LinkedList<Word>();
String x = "?";
String x2 = "?";
if (x.equals(x2))
{
System.out.println("?");
}
}
}
import java.io.FileNotFoundException;
public class testmostFrequentWord
{
public static void main(String[] args)
throws FileNotFoundException
{
mostFrequentWord m = new mostFrequentWord();
Word w = new Word();
m.Read();
w.isEqual();
}
}
been at it all week, thats all i got. please help :)