List the Words once and the line numbers on which they appear The content pane of the
Question:
List the Words once and the line numbers on which they appear
The content pane of the GUI should still have a grid layout of one row and two columns. When the user clicks on List a choice can be made of one of the five vowels, as before. Clicking on a vowel should list each word in the file that starts with that vowel, with each unique word appearing once in the list, along with all the line numbers on which that words appears.
Modify the WordLine class to store multiple lines
Change the int that was being used in the WordLine to an ArrayList of integers that can store all the line numbers on which the word appears.
Example showing the GUI if the user chooses "I" from the List menu item
Input file: GUI:
In this file it is shown 1. In this file it is shown I: 3
that that there is more 2. That there is more In: 1
than one word with I 3. Than one word with I is: 1, 2
it: 1
Do the assignment using java
Helpful files:
1.
pro-2
Use linked lists to store and sort words
create a class called WordList based on the linked list with head node as shown in lecture. The data in
the nodes should be a String.
have to create a class called UnsortedWordList that extends WordList. It should have an append method.
have to create a class called SortedWordList that extends WordList. It should have a method called add which takes a String as a parameter and inserts that word into the list in a position so that the list remains sorted.
Read from the file and add to the sorted list
For each line in the input file (same file as in project 1), break the line into individual words (Strings) and insert each word into the unsorted list (using append), and into the sorted list (using add).
Display the results in a GUI with a GridLayout of one row and three columns. The first column, as in project 1, should contain the original text, the second column the unsorted words, and the third column the sorted words.
To break down the line of text into individual words, you can consider (1) using a StringTokenizer, (2) scanning the line with the charAt method and using the String substring method (3) using the split method.
2.
proj-3
Use a GUI to open the file and display words
create another class called WordGUI that will be a complete JFrame with a menu bar and menus.
There should be two menus: one called File and another called List. The File menu should have the menu items Open and Quit. The List menu should have five menu items: A, E, I, O, U.
The content pane of the GUI should have a grid layout of one row and two columns. Clicking on File > Open should allow the user to choose a file. That file should be displayed in the left column, with the lines numbered (starting at 1). When the user clicks on List a choice can be made of one of the five vowels. Clicking on a vowel should list all the words starting with that vowel in sorted order in the right column. Each word should have the line number on which it appeared.
create a class to record the word and its line number
have to create a class called WordLine that will have two instance variables: a String for the word, and an int for the line number on which the word appears. There should be a two-argument constructor, and error checking with an exception thrown if the line number is less than 1. You may store the WordLine objects in either an array or a linked list.
The exception thrown should be an InvalidWordLineException which you can create by extending IllegalArgumentException.
Project Management The Managerial Process
ISBN: 9781260570434
8th Edition
Authors: Eric W Larson, Clifford F. Gray