please help me on this ,
Your tasks is to modify BagDyn() class given in BagDynMemAlloc.cpp, to allow up to three duplicates of same item. Initially create a bag with the capacity of 10 items. Ask user to input an item to bag. If the count of current item is already three, then do not add this item to the bag. A sample run given below. A bag with capacity of 10 is ready…
Enter a number: 5
> 5
Enter a number: 3
> 5, 3
Enter a number: 5
> 5, 3, 5
Enter a number: 7
> 5, 3, 5, 7
Enter a number: 5
> 5, 3, 5, 7, 5
Enter a number: 5
Bag has already three
5s. > 5, 3, 5, 7, 5
Enter a number: 1
> 5, 3, 5, 7, 5, 1
Enter a number: 0
> 5, 3, 5, 7, 5, 1, 0
Enter a number: 0
> 5, 3, 5, 7, 5, 1, 0, 0
Enter a number: 0
> 5, 3, 5, 7, 5, 1, 0, 0, 0
Enter a number: 0
Bag has already three 0s.
> 5, 3, 5, 7, 5, 1, 0, 0, 0
A negative user entry quits the program.
Enter a number: -1
Bye..
Assume that user will input numbers from -200 to +200. Raise also message if the bag is overflow, which means user tries to add more than 10 items.
i find the program for a similar question but ” A negative user entry quits the program” when the user enters a negative entry the program should say Bye…and close