Answered step by step
Verified Expert Solution
Link Copied!

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 two-dimensional hybrid linked list (2DHLL)
structure that will be used to store information about employees and their assigned projects. Along
with the 2DHLL structure, you are also asked to implement and use a stack structure to keep
track of the changes that are done on the 2DHLL 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 2DHLL structure and one
for the stack. EmployeeProject2DLL object
head_2DHLL
Figure 1. A general structure for the 2DHLL data. This is a generic view of the structure. In the
program, there could be different rows and columns.
1.2 Member Functions:
Below we explain the list of the member functions of the EmployeeProject2DLL 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 true/false 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 employee-project 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 2DHLL 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 (1)
or descending (0) 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
dynamically-allocated memory of the entire 2DHLL structure.
1.1 Nodes Structures
Below are the structs for the two types of nodes in the 2DHLL data structure and
EmployeeProject2DLL class.
struct ProjectNode
{
string project_name;
int project_priority;
ProjectNode * next;
ProjectNode * prev;
};
struct EmployeeNode
{
string employee_name;
ProjectNode * head;
ProjectNode * tail;
EmployeeNode * down;
I only need the implementation of 2D linked list part , not stack.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

Students also viewed these Databases questions

Question

43 Executive compensation methods. SPHR ONLY

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago