Instructions

  • Store all name and ranking information in a field of type LinkedListCell< NameInformation >[], which is an array of 26 linked lists that each hold a NameInformation as each cell's data. The linked list at index 0 will store the data for all names beginning with an 'A', the linked list at index 1 will store the data for all names beginning with a 'B', etc. Furthermore, the cells within each linked list will be arranged in alphabetical order by name.
  • Allow the user to output all information stored in the array to an output file in alphabetical order by name.
  • Allow the user to input a letter and get a count of how many names begin with that letter.
  • Allow the user to see the most frequently occurring first letter.

Contents

These assignment instructions are organized as follows:

  • GUI Design - Instructions for building the GUI
  • Functionality - The functionality requirements for your program
  • Starting Your Solution - Special instructions for starting your project
  • Coding Requirements - Specific requirements for your code (note that these are requirements, not suggestions)
  • Testing Your Program - Guidance for testing your program

GUI Design

A working executable of this program has been provided for your convenience. The program should first open a window resembling the following:

In particular, note that the GUI uses two Panels to divide the controls into two sections. A Panel is a container to graphically organize groups of controls into sections. For each Panel, set its BorderStyle property to "Fixed 3D".

You will also need to add a SaveFileDialog control to allow you to save the data to an output file.

The GUI should be a fixed size. Select the form and set its FormBorderStyle property to "Fixed3D".

The maximize button on the form should be disabled (which it was in the Lab 13 solution). Select the form and ensure that its MaximizeBox property is set to false.

Functionality

Clicking the "Open Data File" button should work in the same way as it did for Lab 13, although the input file will likely not be sorted. The "Get Statistics" button should function in the same way as it did for Lab 13.

The "Output Sorted File" button should output all NameInformation data stored in your LinkedListCell< NameInformation > array to an output file in sorted order by name. The output should be formatted in the same way as the input file (so for each NameInformation, you write first the name, then the frequency, and then the ranking).

The "Count Names with Letter" button should read the letter out of the text box above, and should count the number of names in the array of linked lists that begin with that letter. The text box below the button should be updated with a count of how many names begin with that letter.

The "Find Most Common Letter" button should update the text box below with the most common starting letter of all the names in the array of linked lists.

Starting Your Solution

Start by creating a folder called "Homework 2" - this should be a direct subfolder of your workspace folder. Then download the model solution unzip the folder, and copy theKsu.Cis300.NameLookup folder and paste it into your Homework 2 folder. Place this solution under source control. You should now have the LinkedListCell class, the NameInformation structure, and the start to the GUI.

Coding Requirements

Remove the LinkedListCell< NameInformation > field from the UserInterface class and add a new field of type LinkedListCell< NameInformation >[]. This field will initially be null, and will eventually be a size-26 array of linked lists of NameInformation, organized by the first letter in the name (names beginning with A will go in spot 0, names beginning with B will go in spot 1, etc.)

Finally, you will modify the UserInterface class to add functionality to the GUI. You should include at least the following methods:

  • An event handler for clicking the "Open File" button. If there are no errors in the file, it should update the linked list array field to be the new array that stores all the data in the file. Remember that the file may not be sorted, but all data must be placed in the correct linked list (by first letter of name, as described above) and inserted into that list in alphabetical order by name (so Adams and Allen would be in the same list, but Adams would come first). If there is an error reading the input file, you should display the exception in a MessageBox and NOT update your linked list array field.
  • An event handler for clicking the "Get Statistics" button. This button should have the same functionality as it did in Lab 13.
  • An event handler for clicking the "Output Sorted File" button. This button should open a SaveFileDialog and allow the user to select an output file. It should output all data in the linked list array in sorted order to the selected output file.
  • An event handler for clicking the "Count Names with Letter button". Its functionality is described in Functionality above.
  • An event handler for clicking the "Find Most Common Letter" button. Its functionality is described in Functionality above.
  • A method that takes as parameters a NameInformation and a LinkedListCell< NameInformation > which is a reference to the first cell in a linked list. It should insert a new cell containing that NameInformation in sorted order by name in the given list. It should return a reference to the first cell in the list.

You may include additional methods if you wish.

One operation that you will perform frequently is converting an upper-case letter ('A' - 'Z') into an array index (0-25). You can compute this index given an upper-case char letter as follows:

int index = letter - 'A';

Testing Your Program

You can compare the behavior of your program with that of the posted executable. With names1 and RnadomNames files

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.