Question
PLEASE ANSWER D , E AND F
C++
COMP SCI
s the class dectaration for the Bag class from your text. Refer to this header file ADT bag Array-based implementation @hile Bag.h #ifndefBAG "defineBAG - template cclass ItemType> class Bag private: static const int DEFAULT BAG SIZE- 6 ItemType items[DEFAULT BAG SIZE];I/ array of Bag items int itemCount; I/l current count of Bag items /I max capacity of the Bag int maxitems; /l Returns either the index of the element in the array items that Il contains the given target or -1, if the array does not contain /l the target. int getindexOf(const ItemType& target) const public: //construct an empty bag Bag(); //returns number of elements in the Bag int getCurrentSize() const; /returns true if Bag is empty, false otherwise bool isEmpty() const; Il adds newEntry to Bag bool add(const ItemType& newEntry); lremoves first occurrence of anEntry from Bag bool remove(const ItemType& anEntry); ll empties the Bag void clear(); /Ireturns true if Bag contains anEntry, false l/otherwise bool contains(const ItemType& anEntry) const; // returns the number of occurrences of anEntry in the Bag int getFrequencyOf(const ItemType& anEntry) const; Il implementation NOT shown #endif
Explanation / Answer
(d)
(e)
(f)