import java.io.File; import java.util.Scanner; import java.util.StringTokenizer; import javax.swing.JOptionPane; import javax.swing.JTextArea; import javax.swing.JScrollPane; public class SingleLinkedListExercise { static class Node { T data; Node next; Node(){} Node(T data){ this.data = data; } // end Node(T data, Node next) { this.data = data; this.next = next; } // end public String toString() { return data + ""; } // end toString } // end Node public SingleLinkedListExercise() { Node header = new Node(); try { Scanner fileScanner = new Scanner(new File("src/SingleLinkedListExercise.java")); fileScanner.useDelimiter("[^a-zA-Z]+"); Node p = header; // read and store in the list all unique words from the file while( fileScanner.hasNext() ) { String aWord = fileScanner.next(); // your code goes here } // end while } catch(Exception e) { e.printStackTrace(); } // end try/catch JTextArea outArea = new JTextArea(listToString(header),30,40); JOptionPane.showMessageDialog(null,new JScrollPane(outArea)); } // end constructor String listToString(Node header) { // return a String with each element of the list on a separate line // your code goes here return "Not Completed"; } // end listToString public static void main(String[] args) { new SingleLinkedListExercise(); System.exit(0); } // end main } // end SingleLinkedListExercise