TCSS143 Programming Assignment 9


Category: You will Instantly receive a download link for .zip solution file upon Payment


5/5 - (3 votes)

The purpose of this programming project is to demonstrate a significant culmination of most constructs learn
thus far in the course. This includes Lists, Classes, accessors, mutators, constructors, extension of
Comparable, Comparator, Collections sort, iterators, properly accessing fields of complex objects, and
fundamental File I/O.
Look over Programming Project #4 at the end of the Searching & Sorting Chapter (13), page 869.
Programming Assignment 9 is similar with some added features as described below.
You will submit a single file “” through the Programming Assignment 9 Submission link on
Canvas. This zipped file will contain a minimum of 4 files which make up the solution to this assignment.
The standard grading rules (documentation included) for all previous assignments applies here as well.
To better prepare you for assignments in more advanced courses, specific step-by-step, method headings,
class names, and the like have been omitted. What remains is a general description (you may need to read
this several times to fully understand the requirements):
You will create a LinkedList of Word objects using all the words found in the input file “words.txt.” A Word
object contains 2 String fields; 1 to store a word in its normal form and the other to store a word in its canonical
form. The canonical form stores a word with its letters in alphabetical order, e.g. bob would be bbo, cat would
be act, program would be agmoprr, and so on. The class Word constructor has the responsibility of storing
the normal form of the word in the normal form field and coverting the normal form into the canonical form
which is stored in the canonical form field (you should call a separate method for this conversion purpose).
Once all the words from the input file have been properly stored in a LinkedList of Word, you should use
Collections to sort this list ascending alphabetically based on the canonical words by making the Word class
Using an Iterator on the LinkedList of Word, create a 2nd list (new LinkedList) consisting of objects of a new
class named AnagramFamily. AnagramFamily should contain at least 2 fields; 1 to hold a list of “Word” words
that are all anagrams of each other (these should all be grouped together in the original canonical sorted list),
and the 2nd field to store an integer value of how many items are in the current list. (Keep in mind, because the
original list contains both the normal and canonical forms, as the AnagramFamily List will also have, a family of
anagrams will all have the same canonical form with different normal forms stored in the normalForm field of
the Word class).
Sort the AnagramFamily LinkedList in descending order based on family size by use of a comparator to be
passed to the Collections sort method.
Next, output the top ten longest families to a file named “out9.txt.” Be sure to format the output to be very clear
and meaningful.
Finally, the first 4 people to complete the assignment should post their output results to the Canvas discussion
forum for the remaining students to see the correct answer.
Be sure to instantiate new objects whenever transferring data from one object to another to avoid a repeat of
the issues involved with Programming Assignment 6. Also, be sure to include various methods for
manipulation and access of fields as well as helper methods to reduce code in main, such as the input/output
of file data.
Keep in mind such items as proper documentation (including javadoc), meaningful variable names, proper
indentation, reduction of redundancy whenever possible, and so on.
Part of your grade will depend on time. If written correctly (use of iterators and care taken when creating the
anagram families), the running time should be less than 3 seconds. Programs that take longer will loose points
based on the time. As encouragement to consider all options for speed, programs taking 1 minute will receive
a 40 point deduction. Any longer than 3 minutes will receive only minimal points (10) for effort.
Though the basic algorithms involved are straight forward enough, there is a great deal of complexity involved
with various levels of access to specific data. As mentioned before and never so importantly as with this
assignment, start early and set a goal for completion by this weekend. Trust me, this is sound advise.