Question: i need the c++ program linked with my previous code that i submitted Create a linked list class in C++ that can add, search, and
i need the c++ program linked with my previous code that i submitted
Create a linked list class in C++ that can add, search, and delete student nodes. Each node in the list has a student object, and a pointer to the next node. A student consists of a name, student number and department You will need files student.h, student.cpp, node.h, node.cpp, list.h, list.cpp, and main.cpp Submitting Your Work Submit your entire directory as a .tar.gz archive, online through Moodle. You can create the archive with these commands: > cd - /CMPT276 > tar cvzf LASTNAME.tar.gz Assignment2 Double check that you have the right file before you submit. Uploading the wrong file will result in a mark of ZERO for the entire assignment Program Specification: Your class names should match their file names Use suitable information encapsulation techniques (i.e. data members should be private and a function not changing the object should be constant). Public member functions for the student class should include the following: A default constructor in which the student's name is "undefined", department is "undefined" and number is 0 A parametrized constructor in which the user specifies the three parameters for the object's data members. You may combine the default and parameterized constructor one. Getters and Setters which return and update their respective data member values Public member functions for the node class should include the following: o A default constructor in which the user specifies the three parameters for the object's data members. You may combine the default and parameterized constructor one. A parametrized constructor in which the user specifies the initial student object and pointer o Getters and Setters which return and update their respective data member values Overload the Public member functions for the list class should include the following: A default constructor in which the list is initialized with a head pointer that points to NULL Getters which return their respective data member Setters which can update respective data member o count_nodes: which returns the total number of nodes in the list o print_list: which outputs all the nodes to the console. Starting from the head to the tail Test your classes in main.cpp. Program must be able to print the linked list to the console. Prompt the user for the action to take, thus calling the appropriate function 1. append 3. delete 5. exit program. 2. search 4. display all students adding a student: prompt the user for the name, number, and department of the student add. Before adding a node, your function should display the total number of nodes in the linked list After successful addition, display a success message and the updated total number of nodes in the list. (Note that in this assignment, there may be multiple students with the same name and/or student number, so no need to check if it already exists) searching for student: prompt the user for the student number and display the corresponding name and department, or a no match found message. deleting a student: prompt the user for the student number to delete and remove the student or a student does not exist message. Remember to free the memory when deleting a student. If there are multiple matching student number display/delete the first one found. Before deleting a node, your function should first display the total number of nodes in the linked list. After successful delete, display a success message and the updated total number of nodes in the list. displaying all students: print each student (name, number, and department) to the console. Remember when deleting a student there are at least two cases Additional Program Specification . All files (.h and.cpp) should include a comment at the top of the file with your name, and a brief description of what the file is for. All functions should be properly documented in the header file, including PRECONDITIONS and POSTCONDITIONS (with those words). You do not need to include this in the function implementation as well. Your code should include appropriate comments, identifying variables (if needed) and describing what each section of code is doing. All identifiers (function and variable names) should be meaningful Your code should have proper indentation and spacing. Make your functions minimal -- do not pass in variables that you do not need. Any objects to be passed as parameters should be passed by reference. Make sure to declare object inputs as const where appropriate Functions which do not modify the object should be const. Sample Output for displaying all students in the list: Number of nodes - 4 [Paul, 1. Economics | Ox61fd58]-->[Mary. 2. Information Systems Ox61fd78)--> [Olumi, 3. Geography |0x61fd98]-->(Johnson, 4, Business Studies 10)--> Grading student class node class list class Main program Documentation & formatting 10% 15% 25% 30% 20% *** NOTE: Your code must compile and execute within the laboratory environment. Code that does not compile will result in a mark of ZERO for the entire assignment. *** ..ll Home 7:26 PM 4% 14 The solution of the above problem can be given as below: /* source-code 7 main.cpp Pinclude include student.h int32_t main(int32_t arge, char. argv[ 1) Student obj ("William 4) obj.insert nodemary, 3); obj.insert_node("ade, 2): obj.insert_node"borris, 1) / print the result / std::cout out getName() getRoll No() getNext() getNext() } return out; void Student::insert_node(std::string full_name, int rol1_no) { Node sudo - new Node (full_nane, roll_no, nullptr); if (head - nullptr) head - sudo;tail - sudor } else tail->set.Next(oudo); tail - sudo } * node.h + Include Guard. node. Inelude Guard / rifndet NODE define NODE_H_ include Fendit * node.cpp" Pinelude "node.h" NodeNode() { fullNane - "Undefined rollNO - 0: next - nullptr: > pode : : Node (std::string full_name, int roll_no. Node *next_field) fullNane - full_name: rollNo - roll_no; next next_field: std::string Mode::getName() { return fullName: int Node::getRollN() { return rollNo: > Rode Node 1 got Next() { return next; void Node::setName(std::string full_name) { fullNane - full name > void Node : set Roll No(int roll_no) { rollNo-roll no int Node::distance_to_tail(Node.head, std::string data) { int count - 0, length - 03 Node. temp - head; while (temp nullptr) { length 1: temp - temp->next; temp-head: while (temp 1 nullptr) if temnantot datel Friends: ostream& operator cired:ostream, const Nodes); 1 rendit node.cpp include "node.h" sode: : Node() { fullName = "undefined rollNo - 0; next - nullptr) } Node. Node(stdi istring full_name, int roll_no, Node *next_field) fullNane - full name; rollNo - roll no next next_field: 3 std::string Node::getName() { return fullName; 2 int Node::getROLINO) return rollNoi Node.Node i getNext() { return next : void Node: 1 setName(stdirstring full_name) fullNane - full_name; void Node: 1set Roll No(int roll_no) rollo - roll noi int Moder distance_to_tail (Node - head, std::string data) { int count = 0, length = 0; Nodo temp - head; while (temp - nullptr) length - 1; temp-temp->next; > temp - head; while (temp ! - nullptr) if (temp->getName() ww data) count +11 break; else { count li temp-temp->next; > return length - count: std::ostream boperatornext - next; output-screen / Dutout: Head--> 41 )--> narv.3 30 - adt.2 de 1-I borr. 1.1 Process finished with exit code Create a linked list class in C++ that can add, search, and delete student nodes. Each node in the list has a student object, and a pointer to the next node. A student consists of a name, student number and department You will need files student.h, student.cpp, node.h, node.cpp, list.h, list.cpp, and main.cpp Submitting Your Work Submit your entire directory as a .tar.gz archive, online through Moodle. You can create the archive with these commands: > cd - /CMPT276 > tar cvzf LASTNAME.tar.gz Assignment2 Double check that you have the right file before you submit. Uploading the wrong file will result in a mark of ZERO for the entire assignment Program Specification: Your class names should match their file names Use suitable information encapsulation techniques (i.e. data members should be private and a function not changing the object should be constant). Public member functions for the student class should include the following: A default constructor in which the student's name is "undefined", department is "undefined" and number is 0 A parametrized constructor in which the user specifies the three parameters for the object's data members. You may combine the default and parameterized constructor one. Getters and Setters which return and update their respective data member values Public member functions for the node class should include the following: o A default constructor in which the user specifies the three parameters for the object's data members. You may combine the default and parameterized constructor one. A parametrized constructor in which the user specifies the initial student object and pointer o Getters and Setters which return and update their respective data member values Overload the Public member functions for the list class should include the following: A default constructor in which the list is initialized with a head pointer that points to NULL Getters which return their respective data member Setters which can update respective data member o count_nodes: which returns the total number of nodes in the list o print_list: which outputs all the nodes to the console. Starting from the head to the tail Test your classes in main.cpp. Program must be able to print the linked list to the console. Prompt the user for the action to take, thus calling the appropriate function 1. append 3. delete 5. exit program. 2. search 4. display all students adding a student: prompt the user for the name, number, and department of the student add. Before adding a node, your function should display the total number of nodes in the linked list After successful addition, display a success message and the updated total number of nodes in the list. (Note that in this assignment, there may be multiple students with the same name and/or student number, so no need to check if it already exists) searching for student: prompt the user for the student number and display the corresponding name and department, or a no match found message. deleting a student: prompt the user for the student number to delete and remove the student or a student does not exist message. Remember to free the memory when deleting a student. If there are multiple matching student number display/delete the first one found. Before deleting a node, your function should first display the total number of nodes in the linked list. After successful delete, display a success message and the updated total number of nodes in the list. displaying all students: print each student (name, number, and department) to the console. Remember when deleting a student there are at least two cases Additional Program Specification . All files (.h and.cpp) should include a comment at the top of the file with your name, and a brief description of what the file is for. All functions should be properly documented in the header file, including PRECONDITIONS and POSTCONDITIONS (with those words). You do not need to include this in the function implementation as well. Your code should include appropriate comments, identifying variables (if needed) and describing what each section of code is doing. All identifiers (function and variable names) should be meaningful Your code should have proper indentation and spacing. Make your functions minimal -- do not pass in variables that you do not need. Any objects to be passed as parameters should be passed by reference. Make sure to declare object inputs as const where appropriate Functions which do not modify the object should be const. Sample Output for displaying all students in the list: Number of nodes - 4 [Paul, 1. Economics | Ox61fd58]-->[Mary. 2. Information Systems Ox61fd78)--> [Olumi, 3. Geography |0x61fd98]-->(Johnson, 4, Business Studies 10)--> Grading student class node class list class Main program Documentation & formatting 10% 15% 25% 30% 20% *** NOTE: Your code must compile and execute within the laboratory environment. Code that does not compile will result in a mark of ZERO for the entire assignment. *** ..ll Home 7:26 PM 4% 14 The solution of the above problem can be given as below: /* source-code 7 main.cpp Pinclude include student.h int32_t main(int32_t arge, char. argv[ 1) Student obj ("William 4) obj.insert nodemary, 3); obj.insert_node("ade, 2): obj.insert_node"borris, 1) / print the result / std::cout out getName() getRoll No() getNext() getNext() } return out; void Student::insert_node(std::string full_name, int rol1_no) { Node sudo - new Node (full_nane, roll_no, nullptr); if (head - nullptr) head - sudo;tail - sudor } else tail->set.Next(oudo); tail - sudo } * node.h + Include Guard. node. Inelude Guard / rifndet NODE define NODE_H_ include Fendit * node.cpp" Pinelude "node.h" NodeNode() { fullNane - "Undefined rollNO - 0: next - nullptr: > pode : : Node (std::string full_name, int roll_no. Node *next_field) fullNane - full_name: rollNo - roll_no; next next_field: std::string Mode::getName() { return fullName: int Node::getRollN() { return rollNo: > Rode Node 1 got Next() { return next; void Node::setName(std::string full_name) { fullNane - full name > void Node : set Roll No(int roll_no) { rollNo-roll no int Node::distance_to_tail(Node.head, std::string data) { int count - 0, length - 03 Node. temp - head; while (temp nullptr) { length 1: temp - temp->next; temp-head: while (temp 1 nullptr) if temnantot datel Friends: ostream& operator cired:ostream, const Nodes); 1 rendit node.cpp include "node.h" sode: : Node() { fullName = "undefined rollNo - 0; next - nullptr) } Node. Node(stdi istring full_name, int roll_no, Node *next_field) fullNane - full name; rollNo - roll no next next_field: 3 std::string Node::getName() { return fullName; 2 int Node::getROLINO) return rollNoi Node.Node i getNext() { return next : void Node: 1 setName(stdirstring full_name) fullNane - full_name; void Node: 1set Roll No(int roll_no) rollo - roll noi int Moder distance_to_tail (Node - head, std::string data) { int count = 0, length = 0; Nodo temp - head; while (temp - nullptr) length - 1; temp-temp->next; > temp - head; while (temp ! - nullptr) if (temp->getName() ww data) count +11 break; else { count li temp-temp->next; > return length - count: std::ostream boperatornext - next; output-screen / Dutout: Head--> 41 )--> narv.3 30 - adt.2 de 1-I borr. 1.1 Process finished with exit code