Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Part 1 : Implement and test a linked listYour program should have the following classes / structsLinkedList Node You should have a . h and

Part 1: Implement and test a linked listYour program should have the following classes/structsLinkedList Node You should have a .h and .cpp file for the LinkedList. Node can be a struct (it has no member functions), and it can be defined inside the LinkedList.h file (before the LinkedList class, as that class has a member of type Node*).The linked list class should implement the following methods (public functions):Constructorinsert(string)- inserts the given string in the list (in alphabetical order) if its not already there. Returns true if successful, false otherwise. No duplicates are allowed.print()- prints the list in-order (all on one line, comma delimited; no comma at the end, a newline instead)This is the only function that produces output on the console.count()- returns a count of the number of strings in the list.Additional detailsProgram should be named LinkedListDemo.Your LinkedList class should have a constructor and destructor (destructor should delete every node)The only linked list method that should produce output to the screen is print().Make sure you use const on all input parameters and accessor methods.Define a main() in a separate cpp file named LinkedListDemo; add code to main to test your classs functions.Part 2: Processing text fileThis portion makes use of the linked list you created in part 1. Each linked list function should be written and thoroughly tested before doing this part.Replace all previous test code with code that opens and reads from a file named linkListTest.txt, and performs the linked list operations specified on each line of the file. Each line will begin with a character denoting what action to perform, and if required by that action, a string. Those two pieces of data will be space delimited. Valid actions are:a Add the string to the listr Remove the string from the listP Print how many strings are in the list and the list of strings (followed by a blank line)f Find the string in the listR Remove all entries from the listAn example data file, and corresponding output, is shown below. Data FileOutput (sent to cout) a Billa Adama Zorroa BillPAdded BillAdded AdamAdded ZorroBill cannot be added againList Contains 3 names: Adam, Bill, ZorroProgram should be well written, function properly, and be both easy and efficient to use. linkedListDemo.cpplinklist.hlinklist.cpplinkListTest.txt you MUST process a file with the exact name linkListTest.txtAnd the executable (your executable name might be different)linkedListDemo.exe. Write in C++
10:33
Search
Part 1: Implement and test a linked list ?()
Your program should have the following classes/structs
LinkedList
Node
You should have a .h and .cpp file for the LinkedList. Node can be a struct (it has no member functions), and it can be defined inside the LinkedList.h file (before the LinkedList class, as that class has a member of type Node*).
The linked list class should implement the following methods (public functions):
Constructor
insert(string)- inserts the given string in the list (in alphabetical order) if it's not already there. Returns true if successful, false otherwise. No duplicates are allowed.
print()- prints the list in-order (all on one line, comma delimited; no comma at the end, a newline instead)
This is the only function that produces output on the console.
count()- returns a count of the number of strings in the list.
Additional details
Program should be named LinkedListDemo.
Your LinkedList class should have a constructor and destructor (destructor should delete every node)
The only linked list method that should produce output to the screen is print().
Make sure you use const on all input parameters and accessor methods.
Define a main() in a separate cpp file named LinkedListDemo; add code to main to test your class's functions.
10:34
Search
Part 2: Processing text file
This portion makes use of the linked list you created in part 1. Each linked list function should be written and thoroughly tested before doing this part.
Replace all previous test code with code that opens and reads from a file named linkListTest.txt, and performs the linked list operations specified on each line of the file. Each line will begin with a character denoting what action to perform, and if required by that action, a string. Those two pieces of data will be space delimited.
Valid actions are:
a Add the string to the list
r Remove the string from the list
P Print how many strings are in the list and the list of strings (followed by a blank line) f Find the string in the list
R Remove all entries from the list
An example data file, and corresponding output, is shown below.
\table[[Data File,Output (sent to cout)],[a Bill,Added Bill],[a Adam,Added Adam],[a Zorro,Added Zorro],[a Bill,Bill cannot be added again],[P,List Contains 3 names: Adam,]]
Program should be well written, functio
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started