Your program will use the licensesa.txt input file, the License.h and License.cpp class files, and the SortedList class files all provided with this assignment.

Problem Description: You are working for your states motor vehicle registry, and it has been discovered that some people in the drivers license database have multiple records. The license records for people whose last name begins with the letter A are stored in the file licensesa.txt. Some of the duplicate records are due to slight differences in spelling of names, so the file needs to be sorted into order by license number to find the duplicates. Each record consists of a license number (a five-digit integer) and a name all on a single line. For the purposes of this problem, the name (last, first) can be stored in a single string because they are not processed separately. The license number and the corresponding string should be kept together in a License class object. Use the functions of the SortedList class to insert License objects into a list that contains no duplicate license numbers. Make no assumptions about the spelling of names or how to correct them. If a second (duplicate) license number is found while reading the data file, do not insert that record into the list; instead write the contents of the duplicate into the file duplicates.txt. Once all the input data has been processed, close the input file and duplicates file and write the sorted list to a file named licenselist.txt.

Objectives to be met (Basis for assignment points):

  • Demonstrate how to modify an ADT linked-list to store components that are objects of a user-defined class.
  • Demonstrate how to modify linked-list member functions to work with component objects of a user-defined class.
  • Demonstrate how to create a sorted list using the modified ADT linked-list that contains no duplicates.
  • Use good programming style and principles when designing main program logic and control structure.
  • Use the SortedList class files, which are included with the License class files and input file already provided. (Notice that this implementation already adds items in sorted order.)
  • The main program driver can use ItemType or License where necessary; do not use the License type anywhere in the ADT files except where you need to define the type definition for ItemType. (See note under Considerations.)
  • Do not change the specifications or implementations of the SortedList class except where noted in these instructions. If you think you have reason to do so, use the Bb Discussion board to explain why and ask if your idea will be acceptable.
  • Echo print the same duplicates to the console (screen) that are written to the duplicates file.
  • Declare operator member functions inside the License.h header file and define them inside the License.cpp implementation file for the less than (<), equal to (==) and not equal to (!=) operators to compare just the license numbers. Use these operators instead of the getLicenseNumber() function in just those SortedList member functions that need to make the necessary comparisons.

Considerations:

  • Check the Discussion Board with this assignment for an algorithm to help get started with a first attempt at completing the program requirements before changing over to using the License class.
  • Modify the typedef statement (in SortedList.h) for ItemType so that it represents the License class type; you will need to include License.h. Modify the SortedList member functions that have an ItemType parameter where a list node component is compared with the ItemType parameter so they use getLicenseNumber()to compare the two license number values.
  • For each input record, read the license number into an integer variable using the extraction >> operator, and use the getline() function to read the entire name (last, first) into a string variable. You can use ignore(1) before reading the name to skip over the leading space that separates each number and name in the file. Read each line from the input file and use the license number and name variables with the 2-argument constructor for the object that gets added to the sorted list: Example: item = ItemType(number, name);
  • Use the IsThere() function to decide whether to write an ItemType record to the duplicates file and write it to the screen, or to insert it into the list. Use the iterator functions ResetList(), HasNext(), and GetNextItem() to traverse the sorted list when writing it to the sorted list file.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be 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 complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.