Modify this C++ code to convert this bag into a dynamic array.Show screenshot of sample outputs.
–Bag.h–
#pragma once
class Bag
{
public:
static const int CAPACITY = 10;
Bag();
void insert(int item);
void removeOne(int item);
void removeAll(int item);
int occurrences(int item);
int size();
void display();
private:
int count;
int data[CAPACITY];
};
–Bag.cpp–
#include <iostream>
#include “Bag.h”
using namespace std;
Bag::Bag()
{
count = 0;
}
void Bag::insert(int item)
{
if (count < CAPACITY)
{
data[count] = item;
count++;
}
}
int Bag::occurrences(int item)
{
int counter = 0;
for (int i = 0; i < count; i++)
{
if (data[i] == item)
counter++;
}
return counter;
}
void Bag::removeOne(int item)
{
int index = 0;