Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE ANSWER A, B AND C COMP CSI C++ s the class dectaration for the Bag class

ID: 3755046 • Letter: P

Question

PLEASE ANSWER A, B AND C
COMP CSI C++

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

please give thumbs up, thanks

a.

Bag <char> myBag=Bag();

b.

myBag.add[ary[0]];

myBag.add[ary[1]];

myBag.add[ary[2]];

c.

char letter;

cout<<"Please enter a character to llo for in myBag";

cin>>letter;

if(myBag.contains(letter))

{

bool flag =myBag.remove(letter);

if(flag==true)

cout<<letter<<" is removed from myBag";

else

cout<<letter<<" is can't removed from myBag";

}

else

{

cout<<letter<<" doesnot exist in myBag";

}