Question: This is what we have to do: 1) Define a class LinkedList and make 2 linked lists. 2) Then, combine the list 1 and list

This is what we have to do:

1) Define a class LinkedList and make 2 linked lists.

2) Then, combine the list 1 and list 2 to make a third linked list. So, list 1 + list 2 = list 3. To do this, we have to overload the '+' operator by doing operator+() to add list1 and list2. Then we have to overload the '=' operator by doing operator=() to set result of list1+list2 equal to list 3.

3) Each item in the linked list will contain a 4 digit ID number made of random integers and a string for a name. Each item of the linked list should also contain the next-?pointer to the next item.

4) From this point on, every operation will be performed on list 3.

5) The operations we have to do is "Add item to the list", "Remove item from the list", "print the entire list", "print one element of the list", and "sort the list according to ID number".

6) To print one element of the list, we will need overload the operator[] ?to print one element of the list using index as shown. Also we need to overload the ostream operator

Could someone please help me do this? I do not understand linked list at all. Your help will be much appreciated!

This is a sample output:

Making list1 Enter student name: John Enter student name: Bob Enter student

Sample output of operations:

name: Jim Making list2 Enter student name: Mike Enter student name: Chris

Making list1 Enter student name: John Enter student name: Bob Enter student name: Jim Making list2 Enter student name: Mike Enter student name: Chris List 1 ID Name 4325 John 5432 Bob 6530 Jim List 2 ID Name 1034 Mike 2309 Chris Combined List 3: ID Name 4325 John 5432 Bob 6530 Jim 1034 Mike 2309 Chris Combined List 3: ID Name 4325 John 5432 Bob 6530 Jim 1034 Mike 2309 Chris Select the following options: 1. Add item 2. Remove item 3. Print list 4. Print individual item 5. Sort list by ID 6. Quit user input: 1 Enter student name: Mary ID Name 4325 John 5432 Bob 6530 Jim 1034 Mike 2309 Chris 4304 Mary user input: 2 Enter ID to be removed: 6530 ID Name 4325 John 5432 Bob 1034 Mike 2309 Chris 4304 Mary user input: 4 Enter index of item: 3 1034 Mike user input: 5 ID Name 1034 Mike 2309 Chris 4304 Mary 4325 John 5432 Bob user input: 6 program ends!

Step by Step Solution

3.45 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

solution Copyable code include include using namespace std class Node friend class LinkedList privat... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!