#include using namespace std; const int LIST_DEFAULT_CAPACITY = 20; class ArrayListInt { private: int capacity; int size; int* list; public: ArrayListInt():capacity(LIST_DEFAULT_CAPACITY), size(0), list(new int[LIST_DEFAULT_CAPACITY]){} ArrayListInt(int capacity):capacity(capacity), size(0), list(new int[capacity]) {} ~ArrayListInt(){ delete [] list;} int getCapacity(){return capacity;} int getSize() {return size;} void add(int element); bool contains(int element); bool remove(int element); void clear(); int* asArray(); }; void ArrayListInt::add(int element) { if(size class ArrayListTemplate { private: int capacity; int size; T* list; public: ArrayListTemplate():capacity(LIST_DEFAULT_CAPACITY), size(0), list(new T[LIST_DEFAULT_CAPACITY]){} ArrayListTemplate(int capacity):capacity(capacity), size(0), list(new T[capacity]) {} ~ArrayListTemplate(){ delete [] list;} int getCapacity(){return capacity;} int getSize() {return size;} void add(T element); bool contains(T element); bool remove(T element); void clear(); T* asArray(); }; template void ArrayListTemplate::add(T element) { if(size bool ArrayListTemplate::contains(T element) { for(int i=0; i bool ArrayListTemplate::remove(T element) { for(int i=0; i void ArrayListTemplate::clear() { for(int i=0; i T* ArrayListTemplate::asArray() { T* copy = new T[size]; for(int i=0; i intList(capacity); ArrayListTemplate doubleList(capacity); for(int i=0; i