Create a dynamic integer array using the base class below.
class collection{
public:
collection();//constructor
virtual void add(int value) = 0; //adds the value to the array
virtual void remove(int index) = 0; //removes and item from the appropriate index location
virtual void print() = 0; //prints item of the array comma seperated.
virtual int get(int index) = 0; gets item at a particular index.
virtual int sum() = 0; //gets the sum of the array
virtual int size() = 0; //gets the size of the array
};
your dynamic array should be able to accept any amount of integers
your data will come from a file. you will have 1 number on each line of the file.
included is a test file data4.dat, but you should be able to read any file.
Your program needs to allow the user to specify the filename they want to read it.
You can add any anything you want to your private area.
This program should use pointers.
Output:
Use the print for comma separated output, then show the sum and the size of the dynamic array.