Question
Your program is to create, access, and update two ordered linked lists. Using the provided class implementations, your driver file should create one list using
Your program is to create, access, and update two ordered linked lists. Using the provided class implementations, your driver file should create one list using the integer type and another using the string type. After creating the two lists, use the input from the intInsert.dat and strInsert.dat files to add data to the ordered linked lists. These files have one data item per line. Insert the data items to their respective list objects.
Once data has been added to the two lists, you will utilize the search function provided by the class to look for certain items in the lists. The intSearch.dat and strSearch.dat files have one data item per line. Search the respective lists for each data item in these files. Your program should display whether or not the item is found in the list.
For example, if your integer list object contains 5, 15, and 25 and the search file contains 7 and 25, your program should output:
7 was NOT found in the list
25 was found in the list
Similar output will be shown when searching for the string items.
You are also required to write an additional function that will be added in the provided linked list class definition. Write a function that will concatenate all the items in the list. You can call the function concat() for short. For a list of integers, this function should return the sum of all items in the list. For a list of strings, it should return a string made up of all the items combined into a longer string.
For example, if your integer list object contains 5, 15, and 25, the concat() function should return 45. If your string list object contains hello and world, the concat() function should return helloworld.
Your program should display the results of the concatenation function call to the screen for both lists.
Hint: You should be able to get this functionality for numerical types and for strings by using the += operator. Recall that this operator is overloaded in the string class to provide concatenation.
FILES:
intInsert = 550374002531
intSearch = 206500400842562
strInsert = helloworldbasketcoffeeprocesswalk
strSearch = jogrunhellocatcoffeejava
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started