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 :)

http://www.daniweb.com/forums/thread274782.html

What is it about the help I gave you in that thread that is insufficient? I gave you code examples, detailed explanations, etc. It seems like you want someone to do your project for you. To do your project, you need to know the following:

Classes, methods, a very basic understanding of Java Generics, how to use Iterators, how to use the equals() method (you don't need to know how to implement it though, but it might help if you read up on it), a basic understanding of how to use the Scanner class or how to otherwise read in from a file. I suggest you get started on reading the Sun Microsystems (now owned by Oracle) Java tutorials.

Oh, and as your incorrectly defined LinkedList (from your previous thread) showed me, you also need to read about variable scope. You can't declare a variable inside a for loop and expect it to exist once the loop finishes. What exactly have you been learning in class all this time?

Edited 6 Years Ago by BestJewSinceJC: n/a

This article has been dead for over six months. Start a new discussion instead.