Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need a main.cpp and an orderArrayListTypeTmp.cpp for this question. The given code is the following: arrayListType.h ----------------------------------------------------------------------------------------------------- #ifndef H_arrayListType #define H_arrayListType class arrayListType {

image text in transcribed

image text in transcribed

I need a main.cpp and an orderArrayListTypeTmp.cpp for this question.

The given code is the following:

arrayListType.h

-----------------------------------------------------------------------------------------------------

#ifndef H_arrayListType

#define H_arrayListType

class arrayListType

{

public:

bool isEmpty() const;

bool isFull() const;

int listSize() const;

int maxListSize() const;

void print() const;

bool isItemAtEqual(int location, int item) const;

virtual void insertAt(int location, int insertItem) = 0;

virtual void insertEnd(int insertItem) = 0;

void removeAt(int location);

void retrieveAt(int location, int& retItem) const;

virtual void replaceAt(int location, int repItem) = 0;

void clearList();

virtual int seqSearch(int searchItem) const = 0;

virtual void remove(int removeItem) = 0;

arrayListType(int size = 100);

arrayListType (const arrayListType& otherList);

virtual ~arrayListType();

protected:

int *list;

int length;

int maxSize;

};

#endif

arrayListTypeImp.cpp

----------------------------------------------------------------------------------------

#include

#include "arrayListType.h"

using namespace std;

bool arrayListType::isEmpty() const

{

return (length == 0);

}

bool arrayListType::isFull() const

{

return (length == maxSize);

}

int arrayListType::listSize() const

{

return length;

}

int arrayListType::maxListSize() const

{

return maxSize;

}

void arrayListType::print() const

{

for (int i = 0; i

cout

cout

}

bool arrayListType::isItemAtEqual(int location, int item) const

{

if (location = length)

{

cout

return false;

}

else

return (list[location] == item);

}

void arrayListType::removeAt(int location)

{

if (location = length)

cout

else

{

for (int i = location; i

list[i] = list[i+1];

length--;

}

}

void arrayListType::retrieveAt(int location, int& retItem) const

{

if (location = length)

cout

else

retItem = list[location];

}

void arrayListType::clearList()

{

length = 0;

}

arrayListType::arrayListType(int size)

{

if (size

{

cout

maxSize = 100;

}

else

maxSize = size;

length = 0;

list = new int[maxSize];

}

arrayListType::~arrayListType()

{

delete [] list;

}

arrayListType::arrayListType(const arrayListType& otherList)

{

maxSize = otherList.maxSize;

length = otherList.length;

list = new int[maxSize];

for (int j = 0; j

list [j] = otherList.list[j];

}//end copy constructor

-------------------------------------------------------------------------------------------------- orderedArrayListType.h

--------------------------------------------------------------------------------------------------

#ifndef H_orderedArrayListType

#define H_orderedArrayListType

#include "arrayListType.h"

class orderedArrayListType: public arrayListType

{

public:

void insertAt(int location, int insertItem);

void insertEnd(int insertItem);

void replaceAt(int location, int repItem);

int seqSearch(int searchItem) const;

void insert(int insertItem);

void remove(int removeItem);

orderedArrayListType(int size = 100);

//Constructor

};

#endif

--------------------------------------------------------------------------------------

This is just the given main.pp for the problem

---------------------------------------------------------------------------------------

//Data: 18 42 78 22 42 5 42 57

#include

#include "orderedArrayListType.h"

using namespace std;

int main() {

// Write your main here

return 0;

}

---------------------------------------------------------------------------------------------------

Again I just need a main.cpp and an orderArrayListTypeTmp.cpp for this question nothing else. Thank you.

Write the definitions of the functions of the that are not given in this chapter. Also, write a program to test various operations of this class. orderedArrayListType 's method inserts an item into the specified position of the list. orderedArrayListType 's method inserts an item into the list. orderedArrayListType 's method inserts an item at the end of a list. orderedArrayListType 's method replaces an item at the specified position in the list. orderedArrayListType 's method returns - 1 or the position of an element if found in the list

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions