Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students explore these related Databases questions

Question

2. How will you handle the situation?

Answered: 3 weeks ago