separate a class’s declaration

use separate files to separate a class’s declaration from its implementationfully understand the necessity of including the big-3 member functions if a class includes a pointer-based dynamic data structurelearn to implement the big-3learn to overload different operatorslearn to implement read-only accessors and mutators for a classlearn to manipulate a singly linked list at both the node-level and list-level
I need 5 files for this:VectorADT.h: declare a class VectorADT to manage a dynamic array of doublesVectorADT.cpp: implement VectorADT’s member and non-member functions as declared in VectorADT.hListADT.h: declare a class ListADT to manage a linked list of integersListADT.cpp: implement ListADT’s member and non-member functions as declared in ListADT.htestVectorList.cpp: test the above member and non-member functions.
1. VectorADT.hDeclare a class of the name VectorADT to manage a dynamic array of doubles. Specifically, include the following data members:double * array; int size; //the number of doubles stored in array int capacity; //the maximum number of doubles that can be stored in array 
The interface (i.e., the public section) of VectorADT is required to include the following functions:a default constructor to initialize the data members as follows: 0–>size, 10->capacity, and allocating a space of 10 doubles to array (of course). Don’t forget to initialize each element on array to 0.00.the “big-3”: destructor, copy constructor and overloaded assignment operatorvoid push_back(double val ); This member function inserts the value ‘val’ to the end of the dynamic arrayvoid resize(int newSize); This member function Resizes the container so that it contains newSize elements. If newSize is smaller than the current container size, the content is reduced to its first newSize elements. You don’t have to reduce the capacity in this case. If newSize is greater than the current container size, the content is expanded by inserting at the end as many elements as needed to reach a size of newSize. You are required to initialize all the new elements to 0.00. If newSize is also greater than the current container capacity, make sure you increase the capacity to 2*newSize, i.e., double the value of newSize. For example, if the current value of capacity is 100 and newSize is 150, your program is going to reallocate memory to increase the capacity of array to 300. void pop_back(); This member function deletes the last number from the array, i.e., it decreases the size of the container by 1.Overload the operator[ ] as a read-only member function to return the i-th element in array. Assume v1 is a VectorADT object, this operator allows one to retrieve the i-th element on array if i is valid using the statement v1[ i ];. Overload the addition operator (operator+) as a member function to add two VectorADT objects, say v1 and v2 if they are of the same size. This member function is not allowed to change either of its two operands. It returns a VectorADT object corresponding to the sum of v1 and v2. With this operator, one can add v1 and v2 as follows: v3 = v1+v2;Overload the put operator (i.e., operator) as a friend function to print out all the elements stored in a VectorADT object. For example, assume the VectorADT object v1 contains the following numbers 1.10, 21.12, -0.81. One can write cout to print out a comma-separated list of these three numbers on the screen. int length() const; This read-only member function returns the current size of the array (i.e., the number of doubles in the container).int curr_capacity() const; This read-only member function returns the current capacity of the array (i.e., the maximum number of doubles that can be stored in the container).
The definition of size and capacity are similar to those used in the vector STL.
2. VectorADT.cppThis program file implements the above list of functions declared in VectorADT.h
3. ListADT.hDeclare a class of the name ListADT to manage a singly linked list of integers. Specifically, include the following data members:class Node { public: Node(){ }; //implement this default constructor as an inline function using an initialization section. 0->value, nullptr->next Node(int val) { } ; //implement this constructor as an inline function using an initialization section. val->value, nullptr->next int value; Node *next }; Node *head; //point to the first node on the linked list int size; //number of nodes on the linked list ` The interface of ListADT is required to include the following functions:a default constructor to initialize the linked list: 0->size, nullptr->headthe “big-3”: destructor, copy constructor and overloaded assignment operatorvoid push_back(int val ); This member function inserts the value ‘val’ to the end of the linked list. void push_front(int val); This member function inserts the value ‘val’ to the front of the linked list. void pop_back(); This member function deletes the last number from the linked list.void pop_front(); This member function deletes the first number from the linked list.Overload the operator[ ] as a read-only member function to return the i-th element on the linked list. Assume list1 is a ListADT object, this operator allows one to retrieve the i-th element on the list if i is valid using the statement list1[ i ];. Note that this operator is not included in the STL list. We include it here to showcase how flexible operator overloading can be.an overloaded put operator (i.e., operator) as a friend to print out all the data items on the linked list as a comma-separated list. For example, if a list l1 contains the following list of numbers 2->4->-1->10. The statement cout will produce 2,4,-1,10 on the standard output.int length() const; This read-only member function returns the current size of the list container (i.e., the number of integers in the container).
4. ListADT.cppThis program file implements the above list of functions declared in ListrADT.h
5. testVectorList.cpp:Include the main() function in this program file to test all the functions you have implemented in this project.

Leave a Reply

Your email address will not be published. Required fields are marked *