Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Introduction In this homework, you are asked to implement a two - dimensional hybrid linked list ( 2 DHLL ) structure that will be used
Introduction
In this homework, you are asked to implement a twodimensional hybrid linked list DHLL
structure that will be used to store information about employees and their assigned projects. Along
with the DHLL structure, you are also asked to implement and use a stack structure to keep
track of the changes that are done on the DHLL structure for possible undoings.
The main program displays a menu offering some options to the user to interact with both data
structures. According to the choice that the user enters, the program acts on and performs the
relevant changes on both of the data structures.
The main program, which utilizes two different classes, is given to you in the homework package.
What you will do is to design and implement these two classes, one for DHLL structure and one
for the stack. EmployeeProjectDLL object
headDHLL
Figure A general structure for the DHLL data. This is a generic view of the structure. In the
program, there could be different rows and columns.
Member Functions:
Below we explain the list of the member functions of the EmployeeProjectDLL class that are
needed for the program to run successfully using the provided main function flow. Feel free to
implement other private member functions for the sake of modularity to be used in the
implementation of the required public member functions but you are not allowed to implement
extra public ones.
Default constructor: Creates an empty object with no employee.
isEmployeeAssignedToProject: This function takes two parameters, an employee name
and a project name. It returns truefalse depending on whether the employee is assigned
to the project or not.
updateProjectPriority: This function takes three parameters; an employee name, a
project name, and a project priority. It does not change anything and returns false, if there
is another project in the list of projects of that employee with the same priority as the
parameter priority. Otherwise, it updates the priority of the project of that employee as the
parameter priority, reorders the list if needed and then returns true.
assignEmployeeToProject: This function takes three parameters; an employee name, a
project name and a project priority. The aim of this function is to assign the project to the
employee, if possible. If the project cannot be added to the employees project list due to
having another project with the same priority, then the structure does not change and the
function returns false. Otherwise, the function returns true and assigns the project to the
employee by observing the ordering rules and if needed by adding a new employee row.
withdrawEmployeeFromProject: This function takes three parameters, an employee
name, a project name and project priority the last one is a reference parameter This
function assumes that there exists such an employeeproject pair in the data structure and
priority is not a criterion for selection. The function simply deletes the project node from
the employee list and returns its priority as the reference parameter. The function itself
does not return anything. Be aware that you cannot have employees with no projects
assigned. If the project to be deleted is the only project that employee has, then the
employee node has to be deleted as well.
printTheEntireList: This function prints the content of the entire DHLL structure in a
predefined format employees in ascending alphabetical order; projects per employee are
in ascending priority order If the list is empty, it prints a specific message indicating that.
Please refer to sample runs for the output format, and specific message.
printEmployeeProjects: This function takes two parameters, an employee name, and an
integer value indicating whether to print the projects of that employee in an ascending
or descending order according to the priorities of the projects.
undo: This function takes four parameters: i a char type indicating the type of the
operation, ii an employee name, iii a project name, and iv project priority. It recognizes
the operation type and based on that, it performs an action that reverses that operation.
There are three types of operations: a for assigning a project; w for withdrawing a
project; u for updating the priority of an existing project.
clear: This function takes no parameters, and is responsible for deallocating the
dynamicallyallocated memory of the entire DHLL structure.
Nodes Structures
Below are the structs for the two types of nodes in the DHLL data structure and
EmployeeProjectDLL class.
struct ProjectNode
string projectname;
int projectpriority;
ProjectNode next;
ProjectNode prev;
;
struct EmployeeNode
string employeename;
ProjectNode head;
ProjectNode tail;
EmployeeNode down;
I only need the implementation of D linked list part not stack.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started