Question: Could you please help. Needs to be in C++. - implement the LinkedList ADT [modify ListLinked.cpp] - implement the following operations: - constructor, copy constructor,

Could you please help. Needs to be in C++.

- implement the LinkedList ADT [modify ListLinked.cpp]

- implement the following operations:

- constructor, copy constructor, assignment operator, destructor; and

- inser

I will include the header file which shows the definitions and the cpp file that needs to be implemented. Please do the implementations on the cpp file.

listlinked.h

//-------------------------------------------------------------------- // // Laboratory 5 ListLinked.h // // Class declaration for the linked implementation of the List ADT // //--------------------------------------------------------------------

#ifndef LISTLINKED_H #define LISTLINKED_H

#pragma warning( disable : 4290 )

#include #include

using namespace std;

template class List { public: List(int ignored = 0); List(const List& other); List& operator=(const List& other); ~List();

void insert(const DataType& newDataItem) throw (logic_error); void remove() throw (logic_error); void replace(const DataType& newDataItem) throw (logic_error); void clear();

bool isEmpty() const; bool isFull() const;

void gotoBeginning() throw (logic_error); void gotoEnd() throw (logic_error); bool gotoNext() throw (logic_error); bool gotoPrior() throw (logic_error);

DataType getCursor() const throw (logic_error);

// Programming exercise 2 void moveToBeginning () throw (logic_error);

// Programming exercise 3 void insertBefore(const DataType& newDataItem) throw (logic_error); void showStructure() const;

private: class ListNode { public: ListNode(const DataType& nodeData, ListNode* nextPtr);

DataType dataItem; ListNode* next; };

ListNode* head; ListNode* cursor;

};

#endif

listlinked.cpp

#include "ListLinked.h"

// ListNode member functions

template List::ListNode::ListNode(const DataType& nodeData, ListNode* nextPtr) { this->dataItem = nodeData; this->next = nextPtr; }

// List member functions

template List::List(int ignored) { }

template List::List(const List& other) { }

template List& List::operator=(const List& other) { }

template List::~List() { }

template void List::insert(const DataType& newDataItem) throw (logic_error) { }

template void List::remove() throw (logic_error) { }

template void List::replace(const DataType& newDataItem) throw (logic_error) { }

template void List::clear() { }

template bool List::isEmpty() const { return false; }

template bool List::isFull() const { return false; }

template void List::gotoBeginning() throw (logic_error) { }

template void List::gotoEnd() throw (logic_error) { }

template bool List::gotoNext() throw (logic_error) { return false; }

template bool List::gotoPrior() throw (logic_error) { return false; }

template DataType List::getCursor() const throw (logic_error) { DataType t = NULL; return t; }

template void List::moveToBeginning() throw (logic_error) { }

template void List::insertBefore(const DataType& newDataItem) throw (logic_error) { }

#include "show5.cpp"

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!