Implement a doubly linked list. The name of the nodes of the list should be Customer. Each node will have two data values (Name: string and Income: double) and two pointers (next, previous). Implement...


Please do it on c++


don't use stl function

must read the instruction

Implement a doubly linked list. The name of the nodes of the list should be Customer. Each<br>node will have two data values (Name: string and Income: double) and two pointers (next,<br>previous). Implement following functions:<br>1. insert_customer(new_name, new_income): This will add a customer node to the last of<br>the list.<br>2. sort_customer(): This function will sort the list based on the name of the customers<br>alphabetically.<br>3. show_last_customer(): This function will display the name and income of the last<br>customer in the list.<br>4. calculate_avg_income(): This function will calculate the average income of all the<br>customers.<br>Remember, this is a doubly linked list. All the functions will have to be based on doubly linked<br>list. You can re-use the given code of doubly linked list in the class materials. Also, you have to<br>add comments before each function in your code. The comment section will explain the<br>steps/process of the functions you have implemented.<br>Example<br>Rahim<br>Karim<br>Jamal<br>Nafis<br>Null<br>Null<br>1200<br>1500<br>1000<br>1300<br>Нead<br>Tail<br>Hints:<br>You have to add these customers using 'insert_customer' function.<br>• Output of 'sort_customer()' will be=> Jamal, Karim, Nafis, Rahim.<br>• Output of 'show_last_customer()' will be=> Nafis, 1300.<br>• Output of 'calculate_avg_income()' will be=> 1250.<br>N.B:<br>1. You have to add comments to each function explaining how you implement the function.<br>2. The use of STL (Library Functions) is forbidden.<br>

Extracted text: Implement a doubly linked list. The name of the nodes of the list should be Customer. Each node will have two data values (Name: string and Income: double) and two pointers (next, previous). Implement following functions: 1. insert_customer(new_name, new_income): This will add a customer node to the last of the list. 2. sort_customer(): This function will sort the list based on the name of the customers alphabetically. 3. show_last_customer(): This function will display the name and income of the last customer in the list. 4. calculate_avg_income(): This function will calculate the average income of all the customers. Remember, this is a doubly linked list. All the functions will have to be based on doubly linked list. You can re-use the given code of doubly linked list in the class materials. Also, you have to add comments before each function in your code. The comment section will explain the steps/process of the functions you have implemented. Example Rahim Karim Jamal Nafis Null Null 1200 1500 1000 1300 Нead Tail Hints: You have to add these customers using 'insert_customer' function. • Output of 'sort_customer()' will be=> Jamal, Karim, Nafis, Rahim. • Output of 'show_last_customer()' will be=> Nafis, 1300. • Output of 'calculate_avg_income()' will be=> 1250. N.B: 1. You have to add comments to each function explaining how you implement the function. 2. The use of STL (Library Functions) is forbidden.
Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here