Question: *** Please make sure to use Visual Studio(C++). Thank you.** ListArray Class Description: You will implement your own List ADT, the ListArray class. 4.1. Implement

*** Please make sure to use Visual Studio(C++). Thank you.**

ListArray Class

Description: You will implement your own List ADT, the ListArray class.

4.1. Implement default constructor: List:: List (int maxNumber )

4.2. Implement copy constructor: List:: List (const List &source)

4.3. Implement operator =: List& List::operator = ( const List &source)

4.4. Implement destructor: List:: ~List ()

4.5. Implement insert (): void List:: insert ( const DataType &newDataItem ) throw ( logic_error )

4.6. Implement remove (): void List:: remove () throw (logic_error)

4.7. Implement replace (): void List:: replace ( const DataType &newDataItem ) throw ( logic_error )

4.8. Implement clear (): void List:: clear ()

4.9. Implement isEmpty():bool List:: isEmpty () const

4.10. Implement isFull(): bool List:: isFull () const

4.11. Implement gotoBeginning ():void List:: gotoBeginning () throw ( logic_error )

4.12. Implement gotoEnd ():void List:: gotoEnd () throw (logic_error )

4.13. Implement gotoNext ():void List:: gotoNext () throw (logic_error )

4.14. Implement gotoPrior ():void List:: gotoPrior () throw (logic_error )

4.15. Implement getCursor (): DataType List:: getCursor () const throw ( logic_error )

4.16. Implement showStructure ():void List:: showStructure ()const

7.1. Implement moveToNth ():void List:: moveToNth (int n ) throw ( logic_error )

7.2. Implement find ():bool List:: find (const DataType &searchDataItem ) throw ( logic_error )

#ifndef LISTARRAY_CPP

#define LISTARRAY_CPP

using namespace std;

#include

#include

#include "ListArray.h"

template < typename DataType >

List::List ( int maxNumber )

// Creates an empty list. Allocates enough memory for maxNumber

// data items (defaults to defMaxListSize).

{

}

template < typename DataType >

List::List ( const List& source )

// Copy constructor. Creates a deep-copy list copied from

// the provided model object, source.

{

}

template < typename DataType >

List& List::operator= ( const List& source )

// Overloaded assignment operator. Resets a list object to contain a

// deep-copy of the provided model object, source.

{

return *this;

}

template < typename DataType >

// Frees the memory used by a list.

List::~List ()

{

}

template < typename DataType >

void List::insert ( const DataType& newDataItem )

throw ( logic_error )

// Inserts newDataItem after the cursor. If the list is empty, then

// newDataItem is inserted as the first (and only) data items in the

// list. In either case, moves the cursor to newDataItem.

{

}

template < typename DataType >

void List::remove () throw ( logic_error )

// Removes the data items marked by the cursor from a list. Moves the

// cursor to the next data item item in the list. Assumes that the

// first list data items "follows" the last list data item.

{

}

template < typename DataType >

void List::replace ( const DataType& newDataItem )

throw ( logic_error )

// Replaces the item marked by the cursor with newDataItem and

// leaves the cursor at newDataItem.

{

}

template < typename DataType >

void List::clear ()

// Removes all the data items from a list.

{

}

template < typename DataType >

bool List::isEmpty () const

// Returns 1 if a list is empty. Otherwise, returns 0.

{

return false;

}

template < typename DataType >

bool List::isFull () const

// Returns 1 if a list is full. Otherwise, returns 0.

{

return false;

}

template < typename DataType >

void List::gotoBeginning ()

throw ( logic_error )

// Moves the cursor to the beginning of the list.

{

}

template < typename DataType >

void List::gotoEnd ()

throw ( logic_error )

// Moves the cursor to the end of the list.

{

}

template < typename DataType >

bool List::gotoNext ()

throw ( logic_error )

// If the cursor is not at the end of a list, then moves the

// cursor to the next item in the list and returns true. Otherwise,

// returns false.

{

return false;

}

template < typename DataType >

bool List::gotoPrior ()

throw ( logic_error )

// If the cursor is not at the beginning of a list, then moves the

// cursor to the preceeding item in the list and returns true.

// Otherwise, returns false.

{

return false;

}

template < typename DataType >

DataType List::getCursor () const

throw ( logic_error )

// Returns the item marked by the cursor.

{

DataType t;

return t;

}

#include "show3.cpp"

template < typename DataType >

void List::moveToNth ( int n )

throw ( logic_error )

// Removes the data item marked by the cursor from a list and

// reinserts it as the nth data item in the list -- where the

// data items are numbered from beginning to end, starting with 0.

// Moves the cursor to the new position of the moved data

// item.

{

}

template < typename DataType >

bool List::find ( const DataType& searchDataItem )

throw ( logic_error )

// Searches a list for searchDataItem. Begins the search with the

// data items marked by the cursor. Moves the cursor through the list

// until either searchDataItem is found (returns true) or the end of the

// list is reached (returns false).

{

return false;

}

#endif // ifndef LISTARRAY_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!