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. Еxample Rahim Karim Jamal Nafis Null Null 1200 1500 1000 1300 Неad 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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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
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.
Transcribed Image 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.
Expert Solution
steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY