Question: In C++ I provide instructions given and code needed. I just need help with the main.cpp file. Also fill in some code for the linkedlist.cpp

In C++ I provide instructions given and code needed. I just need help with the main.cpp file. Also fill in some code for the linkedlist.cpp file attached. Include the employee and linkedlist file into the main file.

These are steps needed in main fucntion.

1. Declares a linked list which stores integers.

2. Prompts user to enter int values and push these values in the linked list, stop adding the values when the user enter 0.

3. Prints the size of the linked list.

4. Prints the values in the linked list.

5. Prompts user to enter a value key, and find if key is in the linked list.

6. Prompts user to enter k (the number of values to be removed), and remove k values from the front.

7. Prints the values stored in the linked list.

8. Declares a linked list which stores strings.

9. Prompts user to enter strings and add these strings in the linked list, stop adding the strings when the user enters "exit".

10. Prints the size of the linked list.

11. Prints the strings in the linked list.

12. Prompts user to enter k (the number of strings to be removed), and remove k strings from the front.

13. Prints the strings stored in the linked list.

14. Declares a linked list which stores employees (the Employee class is provided with this lab material).

15. Prompts user to enter employee's name, id, and department name, and add the employees in the linked list, stop adding when the user enters id as 0.

16. Prints the size of the linked list.

17. Prints the employees in the linked list.

18. Prompts user to enter k (the number of employees to be removed), and remove k employees from the front.

19. Prints the employees stored in the linked list.

Also this is the expected result.In C++ I provide instructions given and code needed. I just need

help with the main.cpp file. Also fill in some code for the

#ifndef EMPLOYEE_H #define EMPLOYEE_H

#include #include

using namespace std;

class Employee { private: string name; int id; string dept;

public:

Employee():name(""),id(0),dept("") {}

Employee(const string &name, int id, const string &dept):name(name),id(id),dept(dept) {}

string get_name() const { return name; }

int get_id() const { return id; }

string get_dept() const { return dept; }

void set_dept(const string &dept) { this->dept = dept; }

void set_name(const string &name) { this->name = name; }

void set_id(int id) { this->id = id; }

void print() const { std::cout

friend ostream &operator

friend bool operator== (const Employee &e1, const Employee &e2) { return (e1.name == e2.name && e1.id == e2.id && e1.dept == e2.dept); }

friend bool operator!= (const Employee &e1, const Employee &e2) { return !(e1.name == e2.name && e1.id == e2.id && e1.dept == e2.dept); }

}; #endif

// LinkedList.cpp #ifndef LL_H #define LL_H #include using namespace std; template class LinkedList { private: struct NodeType { T data; NodeType* next;

NodeType(): data(), next(nullptr) {} NodeType(const T& d): data(d), next(nullptr) {} }; public: // Default constructor LinkedList(): size(0) { head = new NodeType(); }

//Destructor ~LinkedList() { clear(); delete head; } // returns true if the linked list is empty bool empty( ) const { } // Returns the list to the empty state. void clear() { }

// Returns the number of items in the list. int get_size() const { } // Checks if item is in the list. bool find(const T& item) const { } // Inserts item at the front. void push_front(const T& item) { }

// Removes the first item. void pop_front() { if (head->next != nullptr) { } } // Prints the list. void print() const { } public: class iterator { public: iterator(): current(nullptr) { }

T& operator*() { return current->data; }

iterator& operator++() { current = current->next; return *this; }

bool operator==(const iterator& rhs) const { return current == rhs.current; } bool operator!=(const iterator& rhs) const { return !(*this == rhs); }

private: NodeType* current;

friend class LinkedList; }; iterator begin() { iterator itr; itr.current = head->next; return itr; }

iterator end() { iterator itr; itr.current = nullptr; return itr; } private: int size; // the size of the linked list. NodeType* head; // points to the header node. }; #endif

Create a list of integers: 10 20 30 40 50 60 70 80 900 The size of linked list is: 9 The linked list is: 90, 80, 70, 60, 50, 40, 30, 20, 10 Enter the key: 60 Is the key in the list? 1 How many values you want to remove? 3 The list is: 60, 50, 40, 30, 20, 10, Create a list of strings: Jim Tom Alice Bob Ellen Bella Smith Don exit The size of linked list is: 8 The linked list is : Don, Smith, Bella, Ellen, Bob, Alice, Tom, Jim, How many values you want to remove? 3 The linked list is: Ellen, Bob, Alice, Tom, Jim, Create a list of employees: Enqueue employee name, id, dept (enter id 0 to stop): 1 Bob CSE Enqueue employee name, id, dept (enter id o to stop): 2 Ellen Math Enqueue employee name, id, dept (enter ido to stop): 3 Joe Art Enqueue employee name, id, dept (enter id o to stop): 4 Mary CSE Enqueue employee name, id, dept (enter id o to stop): O end end The size of linked list is: 4 The linked list is: 4 Mary CSE, 3 Joe Art, Ellen 2 Math, 1 BOB CSE, How many values you want to remove? 2 The linked list is: 2 Ellen Math, 1 BOB CSE, The main function, 1. Declares a linked list which stores integers. 2. Prompts user to enter int values and push these values in the linked list, stop adding the values when the user enter 0. 3. Prints the size of the linked list. 4. Prints the values in the linked list. 5. Prompts user to enter a value key, and find if key is in the linked list. 6. Prompts user to enter k (the number of values to be removed), and remove k values from the front. 7. Prints the values stored in the linked list. 8. Declares a linked list which stores strings. 9. Prompts user to enter strings and add these strings in the linked list, stop adding the strings when the user enters "exit". 10. Prints the size of the linked list. 11. Prints the strings in the linked list. 12. Prompts user to enter k (the number of strings to be removed), and remove k strings from the front. 13. Prints the strings stored in the linked list. 14. Declares a linked list which stores employees (the Employee class is provided with this lab material). 15. Prompts user to enter employee's name, id, and department name, and add the employees in the linked list, stop adding when the user enters id as 0. 16. Prints the size of the linked list. 17. Prints the employees in the linked list. 18. Prompts user to enter k (the number of employees to be removed), and remove k employees from the front. 19. Prints the employees stored in the linked list. The expected result

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!